diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/algorithm b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/algorithm
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/algorithm
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/algorithm
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/array b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/array
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/array
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/array
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/auto_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/auto_ptr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/auto_ptr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/auto_ptr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/backward_warning.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/backward_warning.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/backward_warning.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/backward_warning.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/binders.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/binders.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/binders.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/binders.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_fun.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_fun.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_fun.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_fun.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/hashtable.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hashtable.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/hashtable.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hashtable.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/backward/strstream b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/strstream
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/backward/strstream
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/strstream
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/algorithmfwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/algorithmfwd.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/algorithmfwd.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/algorithmfwd.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_0.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_0.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_0.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_0.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_2.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_2.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_2.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_2.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_c.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_c.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_c.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_c.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_cxx.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_cxx.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_cxx.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_cxx.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/boost_concept_check.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/boost_concept_check.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/boost_concept_check.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/boost_concept_check.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/char_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/char_traits.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/char_traits.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/char_traits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/cmath.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cmath.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/cmath.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cmath.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/codecvt.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/codecvt.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/codecvt.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/codecvt.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/concept_check.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/concept_check.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/concept_check.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/concept_check.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/cpp_type_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cpp_type_traits.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/cpp_type_traits.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cpp_type_traits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/deque.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/deque.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/deque.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/deque.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/fstream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/fstream.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/fstream.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/fstream.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/functexcept.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functexcept.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/functexcept.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functexcept.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/functional_hash.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functional_hash.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/functional_hash.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functional_hash.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice_array.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice_array.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice_array.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/hashtable.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/hashtable.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/hashtable.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/hashtable.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/indirect_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/indirect_array.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/indirect_array.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/indirect_array.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/ios_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ios_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/ios_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ios_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/istream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/istream.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/istream.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/istream.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/list.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/list.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/list.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/list.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/localefwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/localefwd.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/localefwd.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/localefwd.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/mask_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/mask_array.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/mask_array.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/mask_array.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/move.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/move.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/move.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/move.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream_insert.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream_insert.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream_insert.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream_insert.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/postypes.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/postypes.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/postypes.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/postypes.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/shared_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/shared_ptr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/shared_ptr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/shared_ptr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/slice_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/slice_array.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/slice_array.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/slice_array.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/sstream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/sstream.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/sstream.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/sstream.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algo.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algo.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algo.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algo.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algobase.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algobase.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_bvector.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_bvector.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_bvector.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_bvector.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_construct.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_construct.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_construct.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_construct.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_deque.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_deque.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_deque.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_deque.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_function.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_function.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_function.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_function.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_heap.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_heap.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_heap.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_heap.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_funcs.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_funcs.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_funcs.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_funcs.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_types.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_types.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_types.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_types.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_list.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_list.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_list.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_list.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_map.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_map.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_map.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_map.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multimap.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multimap.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multimap.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multimap.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multiset.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multiset.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multiset.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multiset.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_numeric.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_numeric.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_numeric.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_numeric.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_pair.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_pair.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_pair.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_pair.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_queue.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_queue.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_queue.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_queue.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_raw_storage_iter.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_raw_storage_iter.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_raw_storage_iter.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_raw_storage_iter.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_relops.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_relops.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_relops.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_relops.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_set.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_set.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_set.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_set.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_stack.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_stack.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_stack.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_stack.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tempbuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tempbuf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tempbuf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tempbuf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tree.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tree.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_uninitialized.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_uninitialized.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_uninitialized.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_uninitialized.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_vector.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_vector.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_vector.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_vector.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stream_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stream_iterator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stream_iterator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stream_iterator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf_iterator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf_iterator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf_iterator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/stringfwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stringfwd.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/stringfwd.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stringfwd.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/unique_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/unique_ptr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/unique_ptr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/unique_ptr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_after.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_after.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_after.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_after.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_before.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_before.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_before.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_before.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bits/vector.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/vector.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bits/vector.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/vector.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/bitset b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bitset
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/bitset
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bitset
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/c++0x_warning.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/c++0x_warning.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/c++0x_warning.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/c++0x_warning.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cassert b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cassert
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cassert
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cassert
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ccomplex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ccomplex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ccomplex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ccomplex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cctype b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cctype
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cctype
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cctype
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cerrno b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cerrno
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cerrno
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cerrno
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cfenv b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfenv
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cfenv
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfenv
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cfloat b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfloat
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cfloat
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfloat
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/chrono b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/chrono
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/chrono
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/chrono
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cinttypes b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cinttypes
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cinttypes
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cinttypes
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ciso646 b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ciso646
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ciso646
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ciso646
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/climits b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/climits
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/climits
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/climits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/clocale b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/clocale
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/clocale
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/clocale
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cmath b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cmath
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cmath
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cmath
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/complex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/complex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/complex.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/complex.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/condition_variable b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/condition_variable
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/condition_variable
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/condition_variable
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/csetjmp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csetjmp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/csetjmp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csetjmp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/csignal b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csignal
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/csignal
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csignal
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstdarg b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdarg
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstdarg
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdarg
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstdatomic b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdatomic
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstdatomic
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdatomic
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstdbool b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdbool
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstdbool
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdbool
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstddef b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstddef
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstddef
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstddef
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstdint b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdint
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstdint
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdint
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstdio b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdio
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstdio
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdio
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstdlib b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdlib
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstdlib
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdlib
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cstring b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstring
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cstring
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstring
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ctgmath b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctgmath
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ctgmath
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctgmath
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ctime b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctime
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ctime
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctime
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cwchar b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwchar
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cwchar
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwchar
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cwctype b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwctype
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cwctype
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwctype
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cxxabi-forced.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi-forced.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cxxabi-forced.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi-forced.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/cxxabi.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/cxxabi.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/bitset b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/bitset
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/bitset
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/bitset
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/debug.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/debug.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/debug.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/debug.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/deque b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/deque
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/deque
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/deque
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/formatter.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/formatter.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/formatter.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/formatter.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/functions.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/functions.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/functions.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/functions.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/list b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/list
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/list
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/list
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/macros.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/macros.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/macros.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/macros.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/debug/map
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/map.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/map.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/multimap.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multimap.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/multimap.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multimap.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/multiset.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multiset.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/multiset.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multiset.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_sequence.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_sequence.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_sequence.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_sequence.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/debug/set
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/set.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/set.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/string b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/string
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/string
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/string
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/vector b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/vector
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/vector
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/vector
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/deque b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/deque
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/deque
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/deque
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/exception b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/exception
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/exception_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/exception_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/exception_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_ptr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/exception_ptr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_ptr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/algorithm b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/algorithm
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/algorithm
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/algorithm
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/array_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/array_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/array_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/array_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/atomicity.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/atomicity.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/atomicity.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/atomicity.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/bitmap_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/bitmap_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/bitmap_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/bitmap_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/cast.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/cast.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/cast.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/cast.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/codecvt_specializations.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/codecvt_specializations.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/codecvt_specializations.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/codecvt_specializations.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/concurrence.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/concurrence.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/concurrence.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/concurrence.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/debug_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/debug_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/debug_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/debug_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/enc_filebuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/enc_filebuf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/enc_filebuf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/enc_filebuf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/extptr_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/extptr_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/extptr_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/extptr_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/functional b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/functional
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/functional
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/functional
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/iterator b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/iterator
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/iterator
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/iterator
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/malloc_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/malloc_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/malloc_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/malloc_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/memory b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/memory
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/memory
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/memory
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/mt_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/mt_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/mt_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/mt_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/new_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/new_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/new_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/new_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric_traits.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric_traits.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric_traits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/assoc_container.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/assoc_container.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/assoc_container.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/assoc_container.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_types.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_types.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cond_dealtor.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cond_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/container_base_dispatch.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/container_base_dispatch.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/debug_map_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/debug_map_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/debug_map_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/debug_map_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/head.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/head.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/node.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/standard_policies.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/standard_policies.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_trace_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_trace_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/type_utils.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/type_utils.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/type_utils.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/type_utils.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/types_traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/types_traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/exception.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/exception.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/exception.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/exception.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/hash_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/hash_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/hash_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/hash_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/list_update_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/list_update_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/list_update_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/list_update_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/priority_queue.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/priority_queue.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/priority_queue.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/priority_queue.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tag_and_trait.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tag_and_trait.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tag_and_trait.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tag_and_trait.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tree_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tree_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tree_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tree_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/trie_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/trie_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/trie_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/trie_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pod_char_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pod_char_traits.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pod_char_traits.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pod_char_traits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pointer.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pointer.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pointer.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pointer.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pool_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pool_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pool_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pool_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/rb_tree b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rb_tree
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/rb_tree
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rb_tree
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/rc_string_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rc_string_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/rc_string_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rc_string_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/rope b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rope
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/rope
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rope
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/ropeimpl.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/ropeimpl.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/ropeimpl.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/ropeimpl.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/slist b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/slist
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/slist
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/slist
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/sso_string_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/sso_string_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/sso_string_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/sso_string_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_filebuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_filebuf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_filebuf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_filebuf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_sync_filebuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_sync_filebuf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_sync_filebuf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_sync_filebuf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/string_conversions.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/string_conversions.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/string_conversions.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/string_conversions.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/throw_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/throw_allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/throw_allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/throw_allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/type_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/type_traits.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/type_traits.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/type_traits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/typelist.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/typelist.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/typelist.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/typelist.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_fwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_fwd.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_fwd.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_fwd.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_util.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_util.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_util.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_util.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/fenv.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fenv.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/fenv.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fenv.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/forward_list b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/forward_list
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/forward_list
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/forward_list
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/fstream b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fstream
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/fstream
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fstream
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/functional b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/functional
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/functional
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/functional
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/initializer_list b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/initializer_list
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/initializer_list
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/initializer_list
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/iomanip b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iomanip
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/iomanip
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iomanip
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ios b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ios
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ios
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ios
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/iosfwd b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iosfwd
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/iosfwd
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iosfwd
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/iostream b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iostream
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/iostream
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iostream
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/istream b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/istream
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/istream
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/istream
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/iterator b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iterator
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/iterator
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iterator
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/limits b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/limits
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/limits
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/limits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/list b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/list
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/list
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/list
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/locale b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/locale
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/locale
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/locale
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/memory b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/memory
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/memory
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/memory
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/mutex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/mutex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/mutex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/mutex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/new b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/new
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/new
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/new
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/numeric b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/numeric
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/numeric
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/numeric
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ostream b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ostream
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ostream
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ostream
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/queue b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/queue
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/queue
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/queue
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/random b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/random
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/random
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/random
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ratio b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ratio
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ratio
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ratio
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/regex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/regex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/regex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/regex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/sstream b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/sstream
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/sstream
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/sstream
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/stack b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stack
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/stack
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stack
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/stdatomic.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdatomic.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/stdatomic.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdatomic.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/stdexcept b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdexcept
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/stdexcept
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdexcept
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/streambuf b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/streambuf
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/streambuf
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/streambuf
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/string b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/string
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/string
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/string
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/system_error b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/system_error
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/system_error
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/system_error
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tgmath.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tgmath.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/thread b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/thread
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/thread
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/thread
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/array b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/array
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/array
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/array
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/bessel_function.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/bessel_function.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/bessel_function.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/bessel_function.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/beta_function.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/beta_function.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/beta_function.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/beta_function.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ccomplex
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ccomplex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cctype b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cctype
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cctype
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cctype
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfenv b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfenv
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfenv
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfenv
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfloat
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfloat
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cinttypes b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cinttypes
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cinttypes
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cinttypes
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/climits
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/climits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cmath b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cmath
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cmath
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cmath
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdarg
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdarg
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdbool
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdbool
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdint b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdint
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdint
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdint
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdio b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdio
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdio
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdio
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdlib b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdlib
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdlib
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdlib
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctgmath
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctgmath
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctime
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctime
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctype.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctype.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwchar b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwchar
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwchar
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwchar
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwctype b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwctype
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwctype
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwctype
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ell_integral.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ell_integral.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ell_integral.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ell_integral.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/exp_integral.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/exp_integral.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/exp_integral.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/exp_integral.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/fenv.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/fenv.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/float.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/float.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional_hash.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional_hash.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional_hash.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional_hash.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/gamma.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/gamma.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/gamma.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/gamma.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/hashtable.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hashtable.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/hashtable.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hashtable.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/hypergeometric.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hypergeometric.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/hypergeometric.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hypergeometric.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/inttypes.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/inttypes.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/legendre_function.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/legendre_function.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/legendre_function.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/legendre_function.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/limits.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/limits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/math.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/math.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/memory b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/memory
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/memory
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/memory
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/modified_bessel_func.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/modified_bessel_func.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/modified_bessel_func.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/modified_bessel_func.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_hermite.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_hermite.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_hermite.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_hermite.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_laguerre.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_laguerre.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_laguerre.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_laguerre.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/random b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/random
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/random
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/random
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/regex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/regex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/regex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/regex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/riemann_zeta.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/riemann_zeta.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/riemann_zeta.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/riemann_zeta.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/shared_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/shared_ptr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/shared_ptr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/shared_ptr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/special_function_util.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/special_function_util.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/special_function_util.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/special_function_util.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdarg.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdarg.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdbool.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdbool.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdint.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdint.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdio.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdio.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdlib.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdlib.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tgmath.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tgmath.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/tuple b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tuple
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/tuple
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tuple
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/type_traits b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/type_traits
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/type_traits
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/type_traits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/utility b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/utility
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/utility
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/utility
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wchar.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wchar.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wctype.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wctype.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/array b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/array
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/array
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/array
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/boost_sp_counted_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/boost_sp_counted_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/boost_sp_counted_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/boost_sp_counted_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cctype b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cctype
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cctype
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cctype
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cfenv b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cfenv
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cfenv
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cfenv
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cinttypes b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cinttypes
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cinttypes
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cinttypes
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cmath b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cmath
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cmath
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cmath
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/complex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/complex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/complex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/complex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdint b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdint
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdint
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdint
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdio b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdio
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdio
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdio
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdlib b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdlib
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdlib
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdlib
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwchar b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwchar
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwchar
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwchar
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwctype b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwctype
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwctype
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwctype
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional_hash.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional_hash.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional_hash.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional_hash.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable_policy.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable_policy.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable_policy.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable_policy.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random.tcc
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random.tcc
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random.tcc
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/regex b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/regex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/regex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/regex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/type_traits b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/type_traits
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/type_traits
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/type_traits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/utility b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/utility
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/utility
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/utility
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tuple b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tuple
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tuple
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tuple
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/type_traits b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/type_traits
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/type_traits
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/type_traits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/typeinfo b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/typeinfo
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/typeinfo
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/typeinfo
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/unordered_map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/unordered_set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/utility b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/utility
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/utility
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/utility
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/valarray b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/valarray
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/valarray
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/valarray
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/vector b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/vector
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/vector
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/vector
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/atomic_word.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/basic_file.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/basic_file.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/basic_file.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++config.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++config.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++config.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++io.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++io.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++io.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++locale.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++locale.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++locale.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cpu_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cpu_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cpu_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_inline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_inline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_inline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_noninline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_noninline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_noninline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/error_constants.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/error_constants.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/error_constants.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/extc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/extc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/extc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-default.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-default.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-default.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-posix.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-posix.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-posix.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-single.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-single.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-single.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-tpf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-tpf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-tpf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/messages_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/messages_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/messages_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/os_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/os_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/os_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdtr1c++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/time_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/time_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/time_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_shared.so
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_static.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_static.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libsupc++.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libsupc++.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/atomic_word.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/basic_file.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/basic_file.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/basic_file.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++config.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++config.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++config.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++io.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++io.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++io.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++locale.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++locale.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++locale.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cpu_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cpu_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cpu_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_inline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_inline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_inline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_noninline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_noninline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_noninline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cxxabi_tweaks.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cxxabi_tweaks.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/error_constants.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/error_constants.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/error_constants.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/extc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/extc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/extc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-default.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-default.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-default.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-posix.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-posix.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-posix.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-single.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-single.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-single.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-tpf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-tpf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-tpf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/messages_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/messages_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/messages_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/os_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/os_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/os_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdtr1c++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/time_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/time_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/time_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_shared.so
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_shared.so
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_static.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_static.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libsupc++.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libsupc++.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/atomic_word.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/basic_file.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/basic_file.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/basic_file.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++config.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++config.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++config.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++io.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++io.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++io.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++locale.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++locale.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++locale.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cpu_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cpu_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cpu_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_inline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_inline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_inline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_noninline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_noninline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_noninline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cxxabi_tweaks.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cxxabi_tweaks.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/error_constants.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/error_constants.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/error_constants.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/extc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/extc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/extc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-default.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-default.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-default.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-posix.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-posix.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-posix.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-single.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-single.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-single.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-tpf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-tpf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-tpf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/messages_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/messages_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/messages_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/os_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/os_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/os_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdtr1c++.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/time_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/time_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/time_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_shared.so
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_shared.so
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_static.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_static.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libsupc++.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/libsupc++.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/atomic_word.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/basic_file.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/basic_file.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/basic_file.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++allocator.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++allocator.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++allocator.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++config.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++config.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++config.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++io.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++io.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++io.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++locale.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++locale.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++locale.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cpu_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cpu_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cpu_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_base.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_base.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_base.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_inline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_inline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_inline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_noninline.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_noninline.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_noninline.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cxxabi_tweaks.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cxxabi_tweaks.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/error_constants.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/error_constants.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/error_constants.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/extc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/extc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/extc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-default.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-default.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-default.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-posix.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-posix.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-posix.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-single.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-single.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-single.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-tpf.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-tpf.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-tpf.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/messages_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/messages_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/messages_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/os_defines.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/os_defines.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/os_defines.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdc++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdc++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdc++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdtr1c++.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/time_members.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/time_members.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/time_members.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_shared.so
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_shared.so
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_static.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_static.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libsupc++.a
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/libsupc++.a
rename to 8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/algorithm b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/algorithm
new file mode 100644
index 0000000..7449ec3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/algorithm
@@ -0,0 +1,69 @@
+// <algorithm> -*- 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/algorithm
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_ALGORITHM
+#define _GLIBCXX_ALGORITHM 1
+
+#pragma GCC system_header
+
+#include <utility> // UK-300.
+#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h>
+
+#ifdef _GLIBCXX_PARALLEL
+# include <parallel/algorithm>
+#endif
+
+#endif /* _GLIBCXX_ALGORITHM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/array b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/array
new file mode 100644
index 0000000..a0bdd24
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/array
@@ -0,0 +1,274 @@
+// <array> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <bits/stl_algobase.h>
+#include <bits/range_access.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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 _Tp*                                    pointer;
+      typedef const _Tp*                              const_pointer;
+      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.
+
+      // DR 776.
+      void
+      fill(const value_type& __u)
+      { std::fill_n(begin(), size(), __u); }
+
+      void
+      swap(array& __other)
+      { std::swap_ranges(begin(), end(), __other.begin()); }
+
+      // Iterators.
+      iterator
+      begin()
+      { return iterator(std::__addressof(_M_instance[0])); }
+
+      const_iterator
+      begin() const 
+      { return const_iterator(std::__addressof(_M_instance[0])); }
+
+      iterator
+      end()
+      { return iterator(std::__addressof(_M_instance[_Nm])); }
+
+      const_iterator
+      end() const
+      { return const_iterator(std::__addressof(_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()); }
+
+      const_iterator
+      cbegin() const 
+      { return const_iterator(std::__addressof(_M_instance[0])); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(std::__addressof(_M_instance[_Nm])); }
+
+      const_reverse_iterator 
+      crbegin() const
+      { return const_reverse_iterator(end()); }
+
+      const_reverse_iterator 
+      crend() const
+      { return const_reverse_iterator(begin()); }
+
+      // Capacity.
+      constexpr size_type 
+      size() const { return _Nm; }
+
+      constexpr size_type 
+      max_size() const { return _Nm; }
+
+      constexpr 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 (__n >= _Nm)
+	  std::__throw_out_of_range(__N("array::at"));
+	return _M_instance[__n];
+      }
+
+      const_reference
+      at(size_type __n) const
+      {
+	if (__n >= _Nm)
+	  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 std::__addressof(_M_instance[0]); }
+
+      const _Tp*
+      data() const
+      { return std::__addressof(_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)
+    { __one.swap(__two); }
+
+  // Tuple interface to class template array [6.2.2.5].
+
+  /// tuple_size
+  template<typename _Tp> 
+    class tuple_size;
+
+  /// tuple_element
+  template<std::size_t _Int, typename _Tp>
+    class tuple_element;
+
+  template<typename _Tp, std::size_t _Nm>
+    struct tuple_size<array<_Tp, _Nm> >
+    { static const std::size_t value = _Nm; };
+
+  template<typename _Tp, std::size_t _Nm>
+    const std::size_t
+    tuple_size<array<_Tp, _Nm> >::value;  
+
+  template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+    struct tuple_element<_Int, array<_Tp, _Nm> >
+    { typedef _Tp type; };
+
+  template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+    inline _Tp&
+    get(array<_Tp, _Nm>& __arr)
+    { return __arr[_Int]; }
+
+  template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+    inline const _Tp&
+    get(const array<_Tp, _Nm>& __arr)
+    { return __arr[_Int]; }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_ARRAY
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/atomic b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/atomic
new file mode 100644
index 0000000..a19891d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/atomic
@@ -0,0 +1,1054 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/atomic
+ *  This is a Standard C++ Library header.
+ */
+
+// 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_ATOMIC
+#define _GLIBCXX_ATOMIC 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#endif
+
+#include <bits/atomic_base.h>
+#include <bits/atomic_0.h>
+#include <bits/atomic_2.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup atomics
+   * @{
+   */
+
+  /// 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& operator=(const atomic_bool&) volatile = delete;
+
+    constexpr atomic_bool(bool __i) : _M_base(__i) { }
+
+    bool
+    operator=(bool __i)
+    { return _M_base.operator=(__i); }
+
+    operator bool() const
+    { return _M_base.load(); }
+
+    operator bool() const volatile
+    { return _M_base.load(); }
+
+    bool
+    is_lock_free() const { return _M_base.is_lock_free(); }
+
+    bool
+    is_lock_free() const volatile { return _M_base.is_lock_free(); }
+
+    void
+    store(bool __i, memory_order __m = memory_order_seq_cst)
+    { _M_base.store(__i, __m); }
+
+    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
+    { return _M_base.load(__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)
+    { return _M_base.exchange(__i, __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)
+    { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+    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)
+    { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+    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)
+    { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+    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)
+    { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+
+    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); }
+  };
+
+
+  /// 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& operator=(const atomic&) volatile = delete;
+
+      constexpr atomic(_Tp __i) : _M_i(__i) { }
+
+      operator _Tp() const;
+
+      operator _Tp() const volatile;
+
+      _Tp
+      operator=(_Tp __i) { store(__i); return __i; }
+
+      _Tp
+      operator=(_Tp __i) volatile { store(__i); return __i; }
+
+      bool
+      is_lock_free() const;
+
+      bool
+      is_lock_free() const volatile;
+
+      void
+      store(_Tp, memory_order = memory_order_seq_cst);
+
+      void
+      store(_Tp, memory_order = memory_order_seq_cst) volatile;
+
+      _Tp
+      load(memory_order = memory_order_seq_cst) const;
+
+      _Tp
+      load(memory_order = memory_order_seq_cst) const volatile;
+
+      _Tp
+      exchange(_Tp __i, memory_order = memory_order_seq_cst);
+
+      _Tp
+      exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
+
+      bool
+      compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order);
+
+      bool
+      compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
+
+      bool
+      compare_exchange_weak(_Tp&, _Tp, memory_order = memory_order_seq_cst);
+
+      bool
+      compare_exchange_weak(_Tp&, _Tp,
+			    memory_order = memory_order_seq_cst) volatile;
+
+      bool
+      compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order);
+
+      bool
+      compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
+
+      bool
+      compare_exchange_strong(_Tp&, _Tp, memory_order = memory_order_seq_cst);
+
+      bool
+      compare_exchange_strong(_Tp&, _Tp,
+			      memory_order = memory_order_seq_cst) volatile;
+    };
+
+
+  /// Partial specialization for pointer types.
+  template<typename _Tp>
+    struct atomic<_Tp*>
+    {
+      typedef _Tp* 			__pointer_type;
+      typedef __atomic_base<_Tp*>	__base_type;
+      __base_type			_M_b;
+
+      atomic() = default;
+      ~atomic() = default;
+      atomic(const atomic&) = delete;
+      atomic& operator=(const atomic&) = delete;
+      atomic& operator=(const atomic&) volatile = delete;
+
+      constexpr atomic(__pointer_type __p) : _M_b(__p) { }
+
+      operator __pointer_type() const
+      { return __pointer_type(_M_b); }
+
+      operator __pointer_type() const volatile
+      { return __pointer_type(_M_b); }
+
+      __pointer_type
+      operator=(__pointer_type __p)
+      { return _M_b.operator=(__p); }
+
+      __pointer_type
+      operator=(__pointer_type __p) volatile
+      { return _M_b.operator=(__p); }
+
+      __pointer_type
+      operator++(int)
+      { return _M_b++; }
+
+      __pointer_type
+      operator++(int) volatile
+      { return _M_b++; }
+
+      __pointer_type
+      operator--(int)
+      { return _M_b--; }
+
+      __pointer_type
+      operator--(int) volatile
+      { return _M_b--; }
+
+      __pointer_type
+      operator++()
+      { return ++_M_b; }
+
+      __pointer_type
+      operator++() volatile
+      { return ++_M_b; }
+
+      __pointer_type
+      operator--()
+      { return --_M_b; }
+
+      __pointer_type
+      operator--() volatile
+      { return --_M_b; }
+
+      __pointer_type
+      operator+=(ptrdiff_t __d)
+      { return _M_b.operator+=(__d); }
+
+      __pointer_type
+      operator+=(ptrdiff_t __d) volatile
+      { return _M_b.operator+=(__d); }
+
+      __pointer_type
+      operator-=(ptrdiff_t __d)
+      { return _M_b.operator-=(__d); }
+
+      __pointer_type
+      operator-=(ptrdiff_t __d) volatile
+      { return _M_b.operator-=(__d); }
+
+      bool
+      is_lock_free() const
+      { return _M_b.is_lock_free(); }
+
+      bool
+      is_lock_free() const volatile
+      { return _M_b.is_lock_free(); }
+
+      void
+      store(__pointer_type __p, memory_order __m = memory_order_seq_cst)
+      { return _M_b.store(__p, __m); }
+
+      void
+      store(__pointer_type __p,
+	    memory_order __m = memory_order_seq_cst) volatile
+      { return _M_b.store(__p, __m); }
+
+      __pointer_type
+      load(memory_order __m = memory_order_seq_cst) const
+      { return _M_b.load(__m); }
+
+      __pointer_type
+      load(memory_order __m = memory_order_seq_cst) const volatile
+      { return _M_b.load(__m); }
+
+      __pointer_type
+      exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst)
+      { return _M_b.exchange(__p, __m); }
+
+      __pointer_type
+      exchange(__pointer_type __p,
+	       memory_order __m = memory_order_seq_cst) volatile
+      { return _M_b.exchange(__p, __m); }
+
+      bool
+      compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
+			    memory_order __m1, memory_order __m2)
+      { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
+
+      bool
+      compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
+			    memory_order __m1, memory_order __m2) volatile
+      { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
+
+      bool
+      compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
+			    memory_order __m = memory_order_seq_cst)
+      {
+	return compare_exchange_weak(__p1, __p2, __m,
+				     __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_weak(__pointer_type& __p1, __pointer_type __p2,
+			    memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_weak(__p1, __p2, __m,
+				     __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+			      memory_order __m1, memory_order __m2)
+      { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
+
+      bool
+      compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+			      memory_order __m1, memory_order __m2) volatile
+      { return _M_b.compare_exchange_strong(__p1, __p2, __m1, __m2); }
+
+      bool
+      compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+			      memory_order __m = memory_order_seq_cst)
+      {
+	return _M_b.compare_exchange_strong(__p1, __p2, __m,
+					    __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+			      memory_order __m = memory_order_seq_cst) volatile
+      {
+	return _M_b.compare_exchange_strong(__p1, __p2, __m,
+					    __calculate_memory_order(__m));
+      }
+
+      __pointer_type
+      fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
+      { return _M_b.fetch_add(__d, __m); }
+
+      __pointer_type
+      fetch_add(ptrdiff_t __d,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _M_b.fetch_add(__d, __m); }
+
+      __pointer_type
+      fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
+      { return _M_b.fetch_sub(__d, __m); }
+
+      __pointer_type
+      fetch_sub(ptrdiff_t __d,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _M_b.fetch_sub(__d, __m); }
+    };
+
+
+  /// 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr 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& operator=(const atomic&) volatile = delete;
+
+      constexpr atomic(__integral_type __i) : __base_type(__i) { }
+
+      using __base_type::operator __integral_type;
+      using __base_type::operator=;
+    };
+
+
+  // Function definitions, atomic_flag operations.
+  inline bool
+  atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m)
+  { return __a->test_and_set(__m); }
+
+  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(atomic_flag* __a, memory_order __m)
+  { __a->clear(__m); }
+
+  inline void
+  atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m)
+  { __a->clear(__m); }
+
+  inline bool
+  atomic_flag_test_and_set(atomic_flag* __a)
+  { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
+
+  inline bool
+  atomic_flag_test_and_set(volatile atomic_flag* __a)
+  { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
+
+  inline void
+  atomic_flag_clear(atomic_flag* __a)
+  { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
+
+  inline void
+  atomic_flag_clear(volatile atomic_flag* __a)
+  { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
+
+
+  // Function templates generally applicable to atomic types.
+  template<typename _ITp>
+    inline bool
+    atomic_is_lock_free(const atomic<_ITp>* __a)
+    { return __a->is_lock_free(); }
+
+  template<typename _ITp>
+    inline bool
+    atomic_is_lock_free(const volatile atomic<_ITp>* __a)
+    { return __a->is_lock_free(); }
+
+  template<typename _ITp>
+    inline void
+    atomic_init(atomic<_ITp>* __a, _ITp __i);
+
+  template<typename _ITp>
+    inline void
+    atomic_init(volatile atomic<_ITp>* __a, _ITp __i);
+
+  template<typename _ITp>
+    inline void
+    atomic_store_explicit(atomic<_ITp>* __a, _ITp __i, memory_order __m)
+    { __a->store(__i, __m); }
+
+  template<typename _ITp>
+    inline void
+    atomic_store_explicit(volatile atomic<_ITp>* __a, _ITp __i,
+			  memory_order __m)
+    { __a->store(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_load_explicit(const atomic<_ITp>* __a, memory_order __m)
+    { return __a->load(__m); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_load_explicit(const volatile atomic<_ITp>* __a,
+			 memory_order __m)
+    { return __a->load(__m); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_exchange_explicit(atomic<_ITp>* __a, _ITp __i,
+			     memory_order __m)
+    { return __a->exchange(__i, __m); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_exchange_explicit(volatile atomic<_ITp>* __a, _ITp __i,
+			     memory_order __m)
+    { return __a->exchange(__i, __m); }
+
+  template<typename _ITp>
+    inline bool
+    atomic_compare_exchange_weak_explicit(atomic<_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_weak_explicit(volatile atomic<_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(atomic<_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 bool
+    atomic_compare_exchange_strong_explicit(volatile atomic<_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 void
+    atomic_store(atomic<_ITp>* __a, _ITp __i)
+    { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline void
+    atomic_store(volatile atomic<_ITp>* __a, _ITp __i)
+    { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_load(const atomic<_ITp>* __a)
+    { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_load(const volatile atomic<_ITp>* __a)
+    { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_exchange(atomic<_ITp>* __a, _ITp __i)
+    { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline _ITp
+    atomic_exchange(volatile atomic<_ITp>* __a, _ITp __i)
+    { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
+
+  template<typename _ITp>
+    inline bool
+    atomic_compare_exchange_weak(atomic<_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_weak(volatile atomic<_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(atomic<_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 bool
+    atomic_compare_exchange_strong(volatile atomic<_ITp>* __a,
+				   _ITp* __i1, _ITp __i2)
+    {
+      return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
+						     memory_order_seq_cst,
+						     memory_order_seq_cst);
+    }
+
+  // Function templates for atomic_integral operations only, using
+  // __atomic_base. Template argument should be constricted to
+  // intergral types as specified in the standard, excluding address
+  // types.
+  template<typename _ITp>
+    inline _ITp
+    atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i,
+			      memory_order __m)
+    { return __a->fetch_add(__i, __m); }
+
+  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(__atomic_base<_ITp>* __a, _ITp __i,
+			      memory_order __m)
+    { return __a->fetch_sub(__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(__atomic_base<_ITp>* __a, _ITp __i,
+			      memory_order __m)
+    { return __a->fetch_and(__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(__atomic_base<_ITp>* __a, _ITp __i,
+			     memory_order __m)
+    { return __a->fetch_or(__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(__atomic_base<_ITp>* __a, _ITp __i,
+			      memory_order __m)
+    { return __a->fetch_xor(__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 _ITp
+    atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_add_explicit(__a, __i, 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(__atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_sub_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(__atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_and_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(__atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_or_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(__atomic_base<_ITp>* __a, _ITp __i)
+    { return atomic_fetch_xor_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); }
+
+
+  // Partial specializations for pointers.
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_add_explicit(atomic<_ITp*>* __a, ptrdiff_t __d,
+			      memory_order __m)
+    { return __a->fetch_add(__d, __m); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_add_explicit(volatile atomic<_ITp*>* __a, ptrdiff_t __d,
+			      memory_order __m)
+    { return __a->fetch_add(__d, __m); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_add(volatile atomic<_ITp*>* __a, ptrdiff_t __d)
+    { return __a->fetch_add(__d); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_add(atomic<_ITp*>* __a, ptrdiff_t __d)
+    { return __a->fetch_add(__d); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_sub_explicit(volatile atomic<_ITp*>* __a,
+			      ptrdiff_t __d, memory_order __m)
+    { return __a->fetch_sub(__d, __m); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_sub_explicit(atomic<_ITp*>* __a, ptrdiff_t __d,
+			      memory_order __m)
+    { return __a->fetch_sub(__d, __m); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_sub(volatile atomic<_ITp*>* __a, ptrdiff_t __d)
+    { return __a->fetch_sub(__d); }
+
+  template<typename _ITp>
+    inline _ITp*
+    atomic_fetch_sub(atomic<_ITp*>* __a, ptrdiff_t __d)
+    { return __a->fetch_sub(__d); }
+  // @} group atomics
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/auto_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/auto_ptr.h
new file mode 100644
index 0000000..e868765
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/auto_ptr.h
@@ -0,0 +1,295 @@
+// auto_ptr implementation -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _BACKWARD_AUTO_PTR_H
+#define _BACKWARD_AUTO_PTR_H 1
+
+#include <bits/c++config.h>
+#include <debug/debug.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  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;
+
+
+  /**
+   *  @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, <em>no longer owns
+       *  anything</em> 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;
+
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 541. shared_ptr template assignment and void
+  template<>
+    class auto_ptr<void>
+    {
+    public:
+      typedef void element_type;
+    } _GLIBCXX_DEPRECATED;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _BACKWARD_AUTO_PTR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/backward_warning.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/backward_warning.h
new file mode 100644
index 0000000..77dff05
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/backward_warning.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/backward_warning.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/binders.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/binders.h
new file mode 100644
index 0000000..f98b56a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/binders.h
@@ -0,0 +1,172 @@
+// Functor implementations -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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.
+ *  Do not attempt to use it directly. @headername{functional}
+ */
+
+#ifndef _BACKWARD_BINDERS_H
+#define _BACKWARD_BINDERS_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 @a 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 <em>1.3 - x</em> 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;
+
+  /// 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;
+
+  /// 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_VERSION
+} // namespace
+
+#endif /* _BACKWARD_BINDERS_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_fun.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_fun.h
new file mode 100644
index 0000000..a76eb73
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_fun.h
@@ -0,0 +1,171 @@
+// 'struct hash' from SGI -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 _BACKWARD_HASH_FUN_H
+#define _BACKWARD_HASH_FUN_H 1
+
+#include <bits/c++config.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_map
new file mode 100644
index 0000000..24c439e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_map
@@ -0,0 +1,600 @@
+// Hashing map implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 _BACKWARD_HASH_MAP
+#define _BACKWARD_HASH_MAP 1
+
+#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
+#include "backward_warning.h"
+#endif
+
+#include <bits/c++config.h>
+#include <backward/hashtable.h>
+#include <bits/concept_check.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_set
new file mode 100644
index 0000000..f110fec
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_set
@@ -0,0 +1,568 @@
+// Hashing set implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 _BACKWARD_HASH_SET
+#define _BACKWARD_HASH_SET 1
+
+#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
+#include "backward_warning.h"
+#endif
+
+#include <bits/c++config.h>
+#include <backward/hashtable.h>
+#include <bits/concept_check.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hashtable.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hashtable.h
new file mode 100644
index 0000000..e04d8fa
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hashtable.h
@@ -0,0 +1,1168 @@
+// Hashtable implementation used by containers -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 _BACKWARD_HASHTABLE_H
+#define _BACKWARD_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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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()
+      : _M_cur(0), _M_ht(0) { }
+
+      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 };
+
+  template<typename _PrimeType>
+    struct _Hashtable_prime_list
+    {
+      static const _PrimeType  __stl_prime_list[_S_num_primes];
+
+      static const _PrimeType*
+      _S_get_prime_list();
+    };
+
+  template<typename _PrimeType> const _PrimeType
+  _Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] =
+    {
+      5ul,          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
+    };
+
+ template<class _PrimeType> inline const _PrimeType*
+ _Hashtable_prime_list<_PrimeType>::_S_get_prime_list()
+ {
+   return __stl_prime_list;
+ }
+
+  inline unsigned long
+  __stl_next_prime(unsigned long __n)
+  {
+    const unsigned long* __first = _Hashtable_prime_list<unsigned long>::_S_get_prime_list();
+    const unsigned long* __last = __first + (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 _Hashtable_prime_list<unsigned long>::
+               _S_get_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];
+      _Node* __saved_slot = 0;
+      size_type __erased = 0;
+
+      if (__first)
+	{
+	  _Node* __cur = __first;
+	  _Node* __next = __cur->_M_next;
+	  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()
+    {
+      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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/strstream b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/strstream
new file mode 100644
index 0000000..7e18a35
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/strstream
@@ -0,0 +1,185 @@
+// Backward-compat support -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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.
+
+/** @file backward/strstream
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{sstream}
+ */
+
+#ifndef _BACKWARD_STRSTREAM
+#define _BACKWARD_STRSTREAM
+
+#include "backward_warning.h"
+#include <iosfwd>
+#include <ios>
+#include <istream>
+#include <ostream>
+#include <string>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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) throw ();
+    strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
+    strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
+
+    strstreambuf(const char* __get, streamsize __n) throw ();
+    strstreambuf(const signed char* __get, streamsize __n) throw ();
+    strstreambuf(const unsigned char* __get, streamsize __n) throw ();
+
+    virtual ~strstreambuf();
+
+  public:
+    void freeze(bool = true) throw ();
+    char* str() throw ();
+    _GLIBCXX_PURE int pcount() const throw ();
+
+  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) throw ();
+
+  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();
+
+    _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
+    char* str() throw ();
+
+  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();
+
+    _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
+    void freeze(bool = true) throw();
+    char* str() throw ();
+    _GLIBCXX_PURE int pcount() const throw ();
+
+  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();
+
+    _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
+    void freeze(bool = true) throw ();
+    _GLIBCXX_PURE int pcount() const throw ();
+    char* str() throw ();
+
+  private:
+    strstreambuf _M_buf;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/algorithmfwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/algorithmfwd.h
new file mode 100644
index 0000000..8632bf5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/algorithmfwd.h
@@ -0,0 +1,815 @@
+// <algorithm> declarations  -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{algorithm}
+ */
+
+#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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /*
+    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
+    shuffle (C++0x)
+    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
+   * @ingroup algorithms
+   */
+
+  /**
+   * @defgroup non_mutating_algorithms Non-Mutating
+   * @ingroup algorithms
+   */
+
+  /**
+   * @defgroup sorting_algorithms Sorting
+   * @ingroup algorithms
+   */
+
+  /**
+   * @defgroup set_algorithms Set Operation
+   * @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
+   * @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&);
+
+  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 _FIter1, typename _FIter2>
+    bool
+    is_permutation(_FIter1, _FIter1, _FIter2);
+
+  template<typename _FIter1, typename _FIter2,
+	   typename _BinaryPredicate>
+    bool
+    is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate);
+
+  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
+
+#if defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+  template<typename _RAIter, typename _UGenerator>
+    void
+    shuffle(_RAIter, _RAIter, _UGenerator&&);
+#endif
+
+  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_VERSION
+
+_GLIBCXX_BEGIN_NAMESPACE_ALGO
+
+  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);
+
+  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,
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+		   _Generator&&);
+#else
+		   _Generator&);
+#endif
+
+  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_NAMESPACE_ALGO
+} // namespace std
+
+#ifdef _GLIBCXX_PARALLEL
+# include <parallel/algorithmfwd.h>
+#endif
+
+#endif
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/allocator.h
new file mode 100644
index 0000000..9d01a60
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/allocator.h
@@ -0,0 +1,239 @@
+// Allocators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/allocator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _ALLOCATOR_H
+#define _ALLOCATOR_H 1
+
+// Define the base class to std::allocator.
+#include <bits/c++allocator.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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 @a 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.
+#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; }
+    };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // A very basic implementation for now.  In general we have to wait for
+  // the availability of the infrastructure described in N2983:  we should
+  // try when either T has a move constructor which cannot throw or T is
+  // CopyContructible.
+  // NB: This code doesn't properly belong here, we should find a more
+  // suited place common to std::vector and std::deque.
+  template<typename _Tp,
+	   bool = __has_trivial_copy(typename _Tp::value_type)>
+    struct __shrink_to_fit
+    { static void _S_do_it(_Tp&) { } };
+
+  template<typename _Tp>
+    struct __shrink_to_fit<_Tp, true>
+    {
+      static void
+      _S_do_it(_Tp& __v)
+      {
+	__try
+	  { _Tp(__v).swap(__v); }
+	__catch(...) { }
+      }
+    };
+
+
+  /// [allocator.tag]
+  struct allocator_arg_t { };
+
+  constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+
+_GLIBCXX_HAS_NESTED_TYPE(allocator_type)
+
+  template<typename _Tp, typename _Alloc,
+	   bool = __has_allocator_type<_Tp>::value>
+    struct __uses_allocator_helper
+    : public false_type { };
+
+  template<typename _Tp, typename _Alloc>
+    struct __uses_allocator_helper<_Tp, _Alloc, true>
+    : public integral_constant<bool, is_convertible<_Alloc,
+				     typename _Tp::allocator_type>::value>
+    { };
+
+  /// [allocator.uses.trait]
+  template<typename _Tp, typename _Alloc>
+    struct uses_allocator
+    : public integral_constant<bool,
+			       __uses_allocator_helper<_Tp, _Alloc>::value>
+    { };
+
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_0.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_0.h
new file mode 100644
index 0000000..84ff779
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_0.h
@@ -0,0 +1,660 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{atomic}
+ */
+
+#ifndef _GLIBCXX_ATOMIC_0_H
+#define _GLIBCXX_ATOMIC_0_H 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+// 0 == __atomic0 == Never lock-free
+namespace __atomic0
+{
+  _GLIBCXX_BEGIN_EXTERN_C
+
+  void
+  atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
+  _GLIBCXX_NOTHROW;
+
+  void
+  __atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
+  _GLIBCXX_NOTHROW;
+
+  _GLIBCXX_CONST __atomic_flag_base*
+  __atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW;
+
+  _GLIBCXX_END_EXTERN_C
+
+  // Implementation specific defines.
+#define _ATOMIC_MEMBER_ _M_i
+
+  // Implementation specific defines.
+#define _ATOMIC_LOAD_(__a, __x)						   \
+  ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type;                          \
+    __i_type* __p = &_ATOMIC_MEMBER_;	   				   \
+    __atomic_flag_base* __g = __atomic_flag_for_address(__p);	  	   \
+    __atomic_flag_wait_explicit(__g, __x);				   \
+    __i_type __r = *__p;						   \
+    atomic_flag_clear_explicit(__g, __x);		       		   \
+    __r; })
+
+#define _ATOMIC_STORE_(__a, __n, __x)					   \
+  ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type;                          \
+    __i_type* __p = &_ATOMIC_MEMBER_;	   				   \
+    __typeof__(__n) __w = (__n);			       		   \
+    __atomic_flag_base* __g = __atomic_flag_for_address(__p);	  	   \
+    __atomic_flag_wait_explicit(__g, __x);				   \
+    *__p = __w;								   \
+    atomic_flag_clear_explicit(__g, __x);		       		   \
+    __w; })
+
+#define _ATOMIC_MODIFY_(__a, __o, __n, __x)				   \
+  ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type;                          \
+    __i_type* __p = &_ATOMIC_MEMBER_;	   				   \
+    __typeof__(__n) __w = (__n);			       		   \
+    __atomic_flag_base* __g = __atomic_flag_for_address(__p);	  	   \
+    __atomic_flag_wait_explicit(__g, __x);				   \
+    __i_type __r = *__p;		       				   \
+    *__p __o __w;					       		   \
+    atomic_flag_clear_explicit(__g, __x);		       		   \
+    __r; })
+
+#define _ATOMIC_CMPEXCHNG_(__a, __e, __n, __x)				   \
+  ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type;                          \
+    __i_type* __p = &_ATOMIC_MEMBER_;	   				   \
+    __typeof__(__e) __q = (__e);			       		   \
+    __typeof__(__n) __w = (__n);			       		   \
+    bool __r;						       		   \
+    __atomic_flag_base* __g = __atomic_flag_for_address(__p);	   	   \
+    __atomic_flag_wait_explicit(__g, __x);				   \
+    __i_type __t = *__p;		       				   \
+    if (*__q == __t) 							   \
+      {									   \
+	*__p = (__i_type)__w;						   \
+	__r = true;							   \
+      }									   \
+    else { *__q = __t; __r = false; }		       			   \
+    atomic_flag_clear_explicit(__g, __x);		       		   \
+    __r; })
+
+
+  /// atomic_flag
+  struct atomic_flag : public __atomic_flag_base
+  {
+    atomic_flag() = default;
+    ~atomic_flag() = default;
+    atomic_flag(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) volatile = delete;
+
+    // Conversion to ATOMIC_FLAG_INIT.
+    atomic_flag(bool __i): __atomic_flag_base({ __i }) { }
+
+    bool
+    test_and_set(memory_order __m = memory_order_seq_cst);
+
+    bool
+    test_and_set(memory_order __m = memory_order_seq_cst) volatile;
+
+    void
+    clear(memory_order __m = memory_order_seq_cst);
+
+    void
+    clear(memory_order __m = memory_order_seq_cst) volatile;
+  };
+
+
+  /// Base class for atomic integrals.
+  //
+  // 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 	__int_type;
+
+      __int_type 	_M_i;
+
+    public:
+      __atomic_base() = default;
+      ~__atomic_base() = default;
+      __atomic_base(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) volatile = delete;
+
+      // Requires __int_type convertible to _M_base._M_i.
+      constexpr __atomic_base(__int_type __i): _M_i (__i) { }
+
+      operator __int_type() const
+      { return load(); }
+
+      operator __int_type() const volatile
+      { return load(); }
+
+      __int_type
+      operator=(__int_type __i)
+      {
+	store(__i);
+	return __i;
+      }
+
+      __int_type
+      operator=(__int_type __i) volatile
+      {
+	store(__i);
+	return __i;
+      }
+
+      __int_type
+      operator++(int)
+      { return fetch_add(1); }
+
+      __int_type
+      operator++(int) volatile
+      { return fetch_add(1); }
+
+      __int_type
+      operator--(int)
+      { return fetch_sub(1); }
+
+      __int_type
+      operator--(int) volatile
+      { return fetch_sub(1); }
+
+      __int_type
+      operator++()
+      { return fetch_add(1) + 1; }
+
+      __int_type
+      operator++() volatile
+      { return fetch_add(1) + 1; }
+
+      __int_type
+      operator--()
+      { return fetch_sub(1) - 1; }
+
+      __int_type
+      operator--() volatile
+      { return fetch_sub(1) - 1; }
+
+      __int_type
+      operator+=(__int_type __i)
+      { return fetch_add(__i) + __i; }
+
+      __int_type
+      operator+=(__int_type __i) volatile
+      { return fetch_add(__i) + __i; }
+
+      __int_type
+      operator-=(__int_type __i)
+      { return fetch_sub(__i) - __i; }
+
+      __int_type
+      operator-=(__int_type __i) volatile
+      { return fetch_sub(__i) - __i; }
+
+      __int_type
+      operator&=(__int_type __i)
+      { return fetch_and(__i) & __i; }
+
+      __int_type
+      operator&=(__int_type __i) volatile
+      { return fetch_and(__i) & __i; }
+
+      __int_type
+      operator|=(__int_type __i)
+      { return fetch_or(__i) | __i; }
+
+      __int_type
+      operator|=(__int_type __i) volatile
+      { return fetch_or(__i) | __i; }
+
+      __int_type
+      operator^=(__int_type __i)
+      { return fetch_xor(__i) ^ __i; }
+
+      __int_type
+      operator^=(__int_type __i) volatile
+      { return fetch_xor(__i) ^ __i; }
+
+      bool
+      is_lock_free() const
+      { return false; }
+
+      bool
+      is_lock_free() const volatile
+      { return false; }
+
+      void
+      store(__int_type __i, memory_order __m = memory_order_seq_cst)
+      {
+	__glibcxx_assert(__m != memory_order_acquire);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+	__glibcxx_assert(__m != memory_order_consume);
+	_ATOMIC_STORE_(this, __i, __m);
+      }
+
+      void
+      store(__int_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);
+      }
+
+      __int_type
+      load(memory_order __m = memory_order_seq_cst) const
+      {
+	__glibcxx_assert(__m != memory_order_release);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+	return _ATOMIC_LOAD_(this, __m);
+      }
+
+      __int_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);
+      }
+
+      __int_type
+      exchange(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return _ATOMIC_MODIFY_(this, =, __i, __m); }
+
+      __int_type
+      exchange(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, =, __i, __m); }
+
+      bool
+      compare_exchange_weak(__int_type& __i1, __int_type __i2,
+			    memory_order __m1, memory_order __m2)
+      {
+	__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(__int_type& __i1, __int_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(__int_type& __i1, __int_type __i2,
+			    memory_order __m = memory_order_seq_cst)
+      {
+	return compare_exchange_weak(__i1, __i2, __m,
+				     __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_weak(__int_type& __i1, __int_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(__int_type& __i1, __int_type __i2,
+			      memory_order __m1, memory_order __m2)
+      {
+	__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(__int_type& __i1, __int_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(__int_type& __i1, __int_type __i2,
+			      memory_order __m = memory_order_seq_cst)
+      {
+	return compare_exchange_strong(__i1, __i2, __m,
+				       __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_strong(__int_type& __i1, __int_type __i2,
+			      memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_strong(__i1, __i2, __m,
+				       __calculate_memory_order(__m));
+      }
+
+      __int_type
+      fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
+
+      __int_type
+      fetch_add(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
+
+      __int_type
+      fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
+
+      __int_type
+      fetch_sub(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
+
+      __int_type
+      fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
+
+      __int_type
+      fetch_and(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
+
+      __int_type
+      fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
+
+      __int_type
+      fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
+
+      __int_type
+      fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
+
+      __int_type
+      fetch_xor(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
+    };
+
+
+  /// Partial specialization for pointer types.
+  template<typename _PTp>
+    struct __atomic_base<_PTp*>
+    {
+    private:
+      typedef _PTp* 	__return_pointer_type;
+      typedef void* 	__pointer_type;
+      __pointer_type 	_M_i;
+
+    public:
+      __atomic_base() = default;
+      ~__atomic_base() = default;
+      __atomic_base(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) volatile = delete;
+
+      // Requires __pointer_type convertible to _M_i.
+      constexpr __atomic_base(__return_pointer_type __p): _M_i (__p) { }
+
+      operator __return_pointer_type() const
+      { return reinterpret_cast<__return_pointer_type>(load()); }
+
+      operator __return_pointer_type() const volatile
+      { return reinterpret_cast<__return_pointer_type>(load()); }
+
+      __return_pointer_type
+      operator=(__pointer_type __p)
+      {
+	store(__p);
+	return reinterpret_cast<__return_pointer_type>(__p);
+      }
+
+      __return_pointer_type
+      operator=(__pointer_type __p) volatile
+      {
+	store(__p);
+	return reinterpret_cast<__return_pointer_type>(__p);
+      }
+
+      __return_pointer_type
+      operator++(int)
+      { return reinterpret_cast<__return_pointer_type>(fetch_add(1)); }
+
+      __return_pointer_type
+      operator++(int) volatile
+      { return reinterpret_cast<__return_pointer_type>(fetch_add(1)); }
+
+      __return_pointer_type
+      operator--(int)
+      { return reinterpret_cast<__return_pointer_type>(fetch_sub(1)); }
+
+      __return_pointer_type
+      operator--(int) volatile
+      { return reinterpret_cast<__return_pointer_type>(fetch_sub(1)); }
+
+      __return_pointer_type
+      operator++()
+      { return reinterpret_cast<__return_pointer_type>(fetch_add(1) + 1); }
+
+      __return_pointer_type
+      operator++() volatile
+      { return reinterpret_cast<__return_pointer_type>(fetch_add(1) + 1); }
+
+      __return_pointer_type
+      operator--()
+      { return reinterpret_cast<__return_pointer_type>(fetch_sub(1) - 1); }
+
+      __return_pointer_type
+      operator--() volatile
+      { return reinterpret_cast<__return_pointer_type>(fetch_sub(1) - 1); }
+
+      __return_pointer_type
+      operator+=(ptrdiff_t __d)
+      { return reinterpret_cast<__return_pointer_type>(fetch_add(__d) + __d); }
+
+      __return_pointer_type
+      operator+=(ptrdiff_t __d) volatile
+      { return reinterpret_cast<__return_pointer_type>(fetch_add(__d) + __d); }
+
+      __return_pointer_type
+      operator-=(ptrdiff_t __d)
+      { return reinterpret_cast<__return_pointer_type>(fetch_sub(__d) - __d); }
+
+      __return_pointer_type
+      operator-=(ptrdiff_t __d) volatile
+      { return reinterpret_cast<__return_pointer_type>(fetch_sub(__d) - __d); }
+
+      bool
+      is_lock_free() const
+      { return true; }
+
+      bool
+      is_lock_free() const volatile
+      { return true; }
+
+      void
+      store(__pointer_type __p, memory_order __m = memory_order_seq_cst)
+      {
+	__glibcxx_assert(__m != memory_order_acquire);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+	__glibcxx_assert(__m != memory_order_consume);
+	_ATOMIC_STORE_(this, __p, __m);
+      }
+
+      void
+      store(__pointer_type __p,
+	    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);
+	volatile __pointer_type* __p2 = &_M_i;
+	__typeof__(__p) __w = (__p);
+	__atomic_flag_base* __g = __atomic_flag_for_address(__p2);
+	__atomic_flag_wait_explicit(__g, __m);
+	*__p2 = reinterpret_cast<__pointer_type>(__w);
+	atomic_flag_clear_explicit(__g, __m);
+	__w;
+      }
+
+      __return_pointer_type
+      load(memory_order __m = memory_order_seq_cst) const
+      {
+	__glibcxx_assert(__m != memory_order_release);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+	void* __v = _ATOMIC_LOAD_(this, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+
+      __return_pointer_type
+      load(memory_order __m = memory_order_seq_cst) const volatile
+      {
+	__glibcxx_assert(__m != memory_order_release);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+	void* __v = _ATOMIC_LOAD_(this, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+
+      __return_pointer_type
+      exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst)
+      {
+	void* __v = _ATOMIC_MODIFY_(this, =, __p, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+
+      __return_pointer_type
+      exchange(__pointer_type __p,
+	       memory_order __m = memory_order_seq_cst) volatile
+      {
+	volatile __pointer_type* __p2 = &_M_i;
+	__typeof__(__p) __w = (__p);
+	__atomic_flag_base* __g = __atomic_flag_for_address(__p2);
+	__atomic_flag_wait_explicit(__g, __m);
+	__pointer_type __r = *__p2;
+	*__p2 = __w;
+	atomic_flag_clear_explicit(__g, __m);
+	__r;
+	return reinterpret_cast<__return_pointer_type>(_M_i);
+      }
+
+      bool
+      compare_exchange_strong(__return_pointer_type& __rp1, __pointer_type __p2,
+			      memory_order __m1, memory_order __m2)
+      {
+	__glibcxx_assert(__m2 != memory_order_release);
+	__glibcxx_assert(__m2 != memory_order_acq_rel);
+	__glibcxx_assert(__m2 <= __m1);
+	__pointer_type& __p1 = reinterpret_cast<void*&>(__rp1);
+	return _ATOMIC_CMPEXCHNG_(this, &__p1, __p2, __m1);
+      }
+
+      bool
+      compare_exchange_strong(__return_pointer_type& __rp1, __pointer_type __p2,
+			      memory_order __m1, memory_order __m2) volatile
+      {
+	__glibcxx_assert(__m2 != memory_order_release);
+	__glibcxx_assert(__m2 != memory_order_acq_rel);
+	__glibcxx_assert(__m2 <= __m1);
+	__pointer_type& __p1 = reinterpret_cast<void*&>(__rp1);
+	return _ATOMIC_CMPEXCHNG_(this, &__p1, __p2, __m1);
+      }
+
+      __return_pointer_type
+      fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
+      {
+	void* __v = _ATOMIC_MODIFY_(this, +=, __d, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+
+      __return_pointer_type
+      fetch_add(ptrdiff_t __d,
+		memory_order __m = memory_order_seq_cst) volatile
+      {
+	void* __v = _ATOMIC_MODIFY_(this, +=, __d, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+
+      __return_pointer_type
+      fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
+      {
+	void* __v = _ATOMIC_MODIFY_(this, -=, __d, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+
+      __return_pointer_type
+      fetch_sub(ptrdiff_t __d,
+		memory_order __m = memory_order_seq_cst) volatile
+      {
+	void* __v = _ATOMIC_MODIFY_(this, -=, __d, __m);
+	return reinterpret_cast<__return_pointer_type>(__v);
+      }
+    };
+
+#undef _ATOMIC_LOAD_
+#undef _ATOMIC_STORE_
+#undef _ATOMIC_MODIFY_
+#undef _ATOMIC_CMPEXCHNG_
+} // namespace __atomic0
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_2.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_2.h
new file mode 100644
index 0000000..f95beca
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_2.h
@@ -0,0 +1,669 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{atomic}
+ */
+
+#ifndef _GLIBCXX_ATOMIC_2_H
+#define _GLIBCXX_ATOMIC_2_H 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+// 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 : public __atomic_flag_base
+  {
+    atomic_flag() = default;
+    ~atomic_flag() = default;
+    atomic_flag(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) = delete;
+    atomic_flag& operator=(const atomic_flag&) volatile = delete;
+
+    // Conversion to ATOMIC_FLAG_INIT.
+    atomic_flag(bool __i): __atomic_flag_base({ __i }) { }
+
+    bool
+    test_and_set(memory_order __m = memory_order_seq_cst)
+    {
+      // 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);
+    }
+
+    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)
+    {
+      __glibcxx_assert(__m != memory_order_consume);
+      __glibcxx_assert(__m != memory_order_acquire);
+      __glibcxx_assert(__m != memory_order_acq_rel);
+
+      __sync_lock_release(&_M_i);
+      if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+	__sync_synchronize();
+    }
+
+    void
+    clear(memory_order __m = memory_order_seq_cst) volatile
+    {
+      __glibcxx_assert(__m != memory_order_consume);
+      __glibcxx_assert(__m != memory_order_acquire);
+      __glibcxx_assert(__m != memory_order_acq_rel);
+
+      __sync_lock_release(&_M_i);
+      if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+	__sync_synchronize();
+    }
+  };
+
+
+  /// Base class for atomic integrals.
+  //
+  // 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
+  //
+  // 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 expect.
+  template<typename _ITp>
+    struct __atomic_base
+    {
+    private:
+      typedef _ITp 	__int_type;
+
+      __int_type 	_M_i;
+
+    public:
+      __atomic_base() = default;
+      ~__atomic_base() = default;
+      __atomic_base(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) volatile = delete;
+
+      // Requires __int_type convertible to _M_i.
+      constexpr __atomic_base(__int_type __i): _M_i (__i) { }
+
+      operator __int_type() const
+      { return load(); }
+
+      operator __int_type() const volatile
+      { return load(); }
+
+      __int_type
+      operator=(__int_type __i)
+      {
+	store(__i);
+	return __i;
+      }
+
+      __int_type
+      operator=(__int_type __i) volatile
+      {
+	store(__i);
+	return __i;
+      }
+
+      __int_type
+      operator++(int)
+      { return fetch_add(1); }
+
+      __int_type
+      operator++(int) volatile
+      { return fetch_add(1); }
+
+      __int_type
+      operator--(int)
+      { return fetch_sub(1); }
+
+      __int_type
+      operator--(int) volatile
+      { return fetch_sub(1); }
+
+      __int_type
+      operator++()
+      { return __sync_add_and_fetch(&_M_i, 1); }
+
+      __int_type
+      operator++() volatile
+      { return __sync_add_and_fetch(&_M_i, 1); }
+
+      __int_type
+      operator--()
+      { return __sync_sub_and_fetch(&_M_i, 1); }
+
+      __int_type
+      operator--() volatile
+      { return __sync_sub_and_fetch(&_M_i, 1); }
+
+      __int_type
+      operator+=(__int_type __i)
+      { return __sync_add_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator+=(__int_type __i) volatile
+      { return __sync_add_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator-=(__int_type __i)
+      { return __sync_sub_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator-=(__int_type __i) volatile
+      { return __sync_sub_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator&=(__int_type __i)
+      { return __sync_and_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator&=(__int_type __i) volatile
+      { return __sync_and_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator|=(__int_type __i)
+      { return __sync_or_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator|=(__int_type __i) volatile
+      { return __sync_or_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator^=(__int_type __i)
+      { return __sync_xor_and_fetch(&_M_i, __i); }
+
+      __int_type
+      operator^=(__int_type __i) volatile
+      { return __sync_xor_and_fetch(&_M_i, __i); }
+
+      bool
+      is_lock_free() const
+      { return true; }
+
+      bool
+      is_lock_free() const volatile
+      { return true; }
+
+      void
+      store(__int_type __i, memory_order __m = memory_order_seq_cst)
+      {
+	__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();
+	  }
+      }
+
+      void
+      store(__int_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();
+	  }
+      }
+
+      __int_type
+      load(memory_order __m = memory_order_seq_cst) const
+      {
+	__glibcxx_assert(__m != memory_order_release);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+
+	__sync_synchronize();
+	__int_type __ret = _M_i;
+	__sync_synchronize();
+	return __ret;
+      }
+
+      __int_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();
+	__int_type __ret = _M_i;
+	__sync_synchronize();
+	return __ret;
+      }
+
+      __int_type
+      exchange(__int_type __i, memory_order __m = memory_order_seq_cst)
+      {
+	// XXX built-in assumes memory_order_acquire.
+	return __sync_lock_test_and_set(&_M_i, __i);
+      }
+
+
+      __int_type
+      exchange(__int_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(__int_type& __i1, __int_type __i2,
+			    memory_order __m1, memory_order __m2)
+      { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+      bool
+      compare_exchange_weak(__int_type& __i1, __int_type __i2,
+			    memory_order __m1, memory_order __m2) volatile
+      { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+      bool
+      compare_exchange_weak(__int_type& __i1, __int_type __i2,
+			    memory_order __m = memory_order_seq_cst)
+      {
+	return compare_exchange_weak(__i1, __i2, __m,
+				     __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_weak(__int_type& __i1, __int_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(__int_type& __i1, __int_type __i2,
+			      memory_order __m1, memory_order __m2)
+      {
+	__glibcxx_assert(__m2 != memory_order_release);
+	__glibcxx_assert(__m2 != memory_order_acq_rel);
+	__glibcxx_assert(__m2 <= __m1);
+
+	__int_type __i1o = __i1;
+	__int_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(__int_type& __i1, __int_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);
+
+	__int_type __i1o = __i1;
+	__int_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(__int_type& __i1, __int_type __i2,
+			      memory_order __m = memory_order_seq_cst)
+      {
+	return compare_exchange_strong(__i1, __i2, __m,
+				       __calculate_memory_order(__m));
+      }
+
+      bool
+      compare_exchange_strong(__int_type& __i1, __int_type __i2,
+			      memory_order __m = memory_order_seq_cst) volatile
+      {
+	return compare_exchange_strong(__i1, __i2, __m,
+				       __calculate_memory_order(__m));
+      }
+
+      __int_type
+      fetch_add(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_add(&_M_i, __i); }
+
+      __int_type
+      fetch_add(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_add(&_M_i, __i); }
+
+      __int_type
+      fetch_sub(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_sub(&_M_i, __i); }
+
+      __int_type
+      fetch_sub(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_sub(&_M_i, __i); }
+
+      __int_type
+      fetch_and(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_and(&_M_i, __i); }
+
+      __int_type
+      fetch_and(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_and(&_M_i, __i); }
+
+      __int_type
+      fetch_or(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_or(&_M_i, __i); }
+
+      __int_type
+      fetch_or(__int_type __i,
+	       memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_or(&_M_i, __i); }
+
+      __int_type
+      fetch_xor(__int_type __i, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_xor(&_M_i, __i); }
+
+      __int_type
+      fetch_xor(__int_type __i,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_xor(&_M_i, __i); }
+    };
+
+
+  /// Partial specialization for pointer types.
+  template<typename _PTp>
+    struct __atomic_base<_PTp*>
+    {
+    private:
+      typedef _PTp* 	__pointer_type;
+
+      __pointer_type 	_M_p;
+
+    public:
+      __atomic_base() = default;
+      ~__atomic_base() = default;
+      __atomic_base(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) = delete;
+      __atomic_base& operator=(const __atomic_base&) volatile = delete;
+
+      // Requires __pointer_type convertible to _M_p.
+      constexpr __atomic_base(__pointer_type __p): _M_p (__p) { }
+
+      operator __pointer_type() const
+      { return load(); }
+
+      operator __pointer_type() const volatile
+      { return load(); }
+
+      __pointer_type
+      operator=(__pointer_type __p)
+      {
+	store(__p);
+	return __p;
+      }
+
+      __pointer_type
+      operator=(__pointer_type __p) volatile
+      {
+	store(__p);
+	return __p;
+      }
+
+      __pointer_type
+      operator++(int)
+      { return fetch_add(1); }
+
+      __pointer_type
+      operator++(int) volatile
+      { return fetch_add(1); }
+
+      __pointer_type
+      operator--(int)
+      { return fetch_sub(1); }
+
+      __pointer_type
+      operator--(int) volatile
+      { return fetch_sub(1); }
+
+      __pointer_type
+      operator++()
+      { return fetch_add(1) + 1; }
+
+      __pointer_type
+      operator++() volatile
+      { return fetch_add(1) + 1; }
+
+      __pointer_type
+      operator--()
+      { return fetch_sub(1) -1; }
+
+      __pointer_type
+      operator--() volatile
+      { return fetch_sub(1) -1; }
+
+      __pointer_type
+      operator+=(ptrdiff_t __d)
+      { return fetch_add(__d) + __d; }
+
+      __pointer_type
+      operator+=(ptrdiff_t __d) volatile
+      { return fetch_add(__d) + __d; }
+
+      __pointer_type
+      operator-=(ptrdiff_t __d)
+      { return fetch_sub(__d) - __d; }
+
+      __pointer_type
+      operator-=(ptrdiff_t __d) volatile
+      { return fetch_sub(__d) - __d; }
+
+      bool
+      is_lock_free() const
+      { return true; }
+
+      bool
+      is_lock_free() const volatile
+      { return true; }
+
+      void
+      store(__pointer_type __p, memory_order __m = memory_order_seq_cst)
+      {
+	__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_p = __p;
+	else
+	  {
+	    // write_mem_barrier();
+	    _M_p = __p;
+	    if (__m == memory_order_seq_cst)
+	      __sync_synchronize();
+	  }
+      }
+
+      void
+      store(__pointer_type __p,
+	    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_p = __p;
+	else
+	  {
+	    // write_mem_barrier();
+	    _M_p = __p;
+	    if (__m == memory_order_seq_cst)
+	      __sync_synchronize();
+	  }
+      }
+
+      __pointer_type
+      load(memory_order __m = memory_order_seq_cst) const
+      {
+	__glibcxx_assert(__m != memory_order_release);
+	__glibcxx_assert(__m != memory_order_acq_rel);
+
+	__sync_synchronize();
+	__pointer_type __ret = _M_p;
+	__sync_synchronize();
+	return __ret;
+      }
+
+      __pointer_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();
+	__pointer_type __ret = _M_p;
+	__sync_synchronize();
+	return __ret;
+      }
+
+      __pointer_type
+      exchange(__pointer_type __p, memory_order __m = memory_order_seq_cst)
+      {
+	// XXX built-in assumes memory_order_acquire.
+	return __sync_lock_test_and_set(&_M_p, __p);
+      }
+
+
+      __pointer_type
+      exchange(__pointer_type __p,
+	       memory_order __m = memory_order_seq_cst) volatile
+      {
+	// XXX built-in assumes memory_order_acquire.
+	return __sync_lock_test_and_set(&_M_p, __p);
+      }
+
+      bool
+      compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+			      memory_order __m1, memory_order __m2)
+      {
+	__glibcxx_assert(__m2 != memory_order_release);
+	__glibcxx_assert(__m2 != memory_order_acq_rel);
+	__glibcxx_assert(__m2 <= __m1);
+
+	__pointer_type __p1o = __p1;
+	__pointer_type __p1n = __sync_val_compare_and_swap(&_M_p, __p1o, __p2);
+
+	// Assume extra stores (of same value) allowed in true case.
+	__p1 = __p1n;
+	return __p1o == __p1n;
+      }
+
+      bool
+      compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+			      memory_order __m1, memory_order __m2) volatile
+      {
+	__glibcxx_assert(__m2 != memory_order_release);
+	__glibcxx_assert(__m2 != memory_order_acq_rel);
+	__glibcxx_assert(__m2 <= __m1);
+
+	__pointer_type __p1o = __p1;
+	__pointer_type __p1n = __sync_val_compare_and_swap(&_M_p, __p1o, __p2);
+
+	// Assume extra stores (of same value) allowed in true case.
+	__p1 = __p1n;
+	return __p1o == __p1n;
+      }
+
+      __pointer_type
+      fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_add(&_M_p, __d); }
+
+      __pointer_type
+      fetch_add(ptrdiff_t __d,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_add(&_M_p, __d); }
+
+      __pointer_type
+      fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
+      { return __sync_fetch_and_sub(&_M_p, __d); }
+
+      __pointer_type
+      fetch_sub(ptrdiff_t __d,
+		memory_order __m = memory_order_seq_cst) volatile
+      { return __sync_fetch_and_sub(&_M_p, __d); }
+    };
+
+} // namespace __atomic2
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_base.h
new file mode 100644
index 0000000..272a4cd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_base.h
@@ -0,0 +1,295 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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_base.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{atomic}
+ */
+
+#ifndef _GLIBCXX_ATOMIC_BASE_H
+#define _GLIBCXX_ATOMIC_BASE_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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;
+
+  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;
+  }
+
+  void
+  atomic_thread_fence(memory_order);
+
+  void
+  atomic_signal_fence(memory_order);
+
+  /// kill_dependency
+  template<typename _Tp>
+    inline _Tp
+    kill_dependency(_Tp __y)
+    {
+      _Tp __ret(__y);
+      return __ret;
+    }
+
+  /**
+   *  @brief Base type for atomic_flag.
+   *
+   *  Base type is POD with data, allowing atomic_flag to derive from
+   *  it and meet the standard layout type requirement. In addition to
+   *  compatibilty with a C interface, this allows different
+   *  implementations of atomic_flag to use the same atomic operation
+   *  functions, via a standard conversion to the __atomic_flag_base
+   *  argument.
+  */
+  _GLIBCXX_BEGIN_EXTERN_C
+
+  struct __atomic_flag_base
+  {
+    bool _M_i;
+  };
+
+  _GLIBCXX_END_EXTERN_C
+
+#define ATOMIC_FLAG_INIT { false }
+
+
+  // Base types for atomics.
+  //
+  // 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.
+  //
+  // 0 == __atomic0 == Never lock-free
+  // 1 == __atomic1 == Best available, sometimes lock-free
+  // 2 == __atomic2 == Always lock-free
+
+  namespace __atomic0
+  {
+    struct atomic_flag;
+
+    template<typename _IntTp>
+      struct __atomic_base;
+  }
+
+  namespace __atomic2
+  {
+    struct atomic_flag;
+
+    template<typename _IntTp>
+      struct __atomic_base;
+  }
+
+  namespace __atomic1
+  {
+    using __atomic2::atomic_flag;
+    using __atomic0::__atomic_base;
+  }
+
+  /// 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_CHAR_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_CHAR16_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_CHAR32_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_WCHAR_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_SHORT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_INT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_LONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_LLONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+
+  inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
+
+
+  /// 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;
+
+  /// atomic_char32_t
+  typedef __atomic_base<char32_t>  		atomic_char32_t;
+
+
+  /// atomic_int_least8_t
+  typedef __atomic_base<int_least8_t>  		atomic_int_least8_t;
+
+  /// atomic_uint_least8_t
+  typedef __atomic_base<uint_least8_t>	       	atomic_uint_least8_t;
+
+  /// atomic_int_least16_t
+  typedef __atomic_base<int_least16_t>	       	atomic_int_least16_t;
+
+  /// atomic_uint_least16_t
+  typedef __atomic_base<uint_least16_t>	       	atomic_uint_least16_t;
+
+  /// atomic_int_least32_t
+  typedef __atomic_base<int_least32_t>	       	atomic_int_least32_t;
+
+  /// atomic_uint_least32_t
+  typedef __atomic_base<uint_least32_t>	       	atomic_uint_least32_t;
+
+  /// atomic_int_least64_t
+  typedef __atomic_base<int_least64_t>	       	atomic_int_least64_t;
+
+  /// atomic_uint_least64_t
+  typedef __atomic_base<uint_least64_t>	       	atomic_uint_least64_t;
+
+
+  /// atomic_int_fast8_t
+  typedef __atomic_base<int_fast8_t>  		atomic_int_fast8_t;
+
+  /// atomic_uint_fast8_t
+  typedef __atomic_base<uint_fast8_t>	      	atomic_uint_fast8_t;
+
+  /// atomic_int_fast16_t
+  typedef __atomic_base<int_fast16_t>	      	atomic_int_fast16_t;
+
+  /// atomic_uint_fast16_t
+  typedef __atomic_base<uint_fast16_t>	      	atomic_uint_fast16_t;
+
+  /// atomic_int_fast32_t
+  typedef __atomic_base<int_fast32_t>	      	atomic_int_fast32_t;
+
+  /// atomic_uint_fast32_t
+  typedef __atomic_base<uint_fast32_t>	      	atomic_uint_fast32_t;
+
+  /// atomic_int_fast64_t
+  typedef __atomic_base<int_fast64_t>	      	atomic_int_fast64_t;
+
+  /// atomic_uint_fast64_t
+  typedef __atomic_base<uint_fast64_t>	      	atomic_uint_fast64_t;
+
+
+  /// atomic_intptr_t
+  typedef __atomic_base<intptr_t>  	       	atomic_intptr_t;
+
+  /// atomic_uintptr_t
+  typedef __atomic_base<uintptr_t>  	       	atomic_uintptr_t;
+
+  /// atomic_size_t
+  typedef __atomic_base<size_t>	 	       	atomic_size_t;
+
+  /// atomic_intmax_t
+  typedef __atomic_base<intmax_t>  	       	atomic_intmax_t;
+
+  /// atomic_uintmax_t
+  typedef __atomic_base<uintmax_t>  	       	atomic_uintmax_t;
+
+  /// atomic_ptrdiff_t
+  typedef __atomic_base<ptrdiff_t>  	       	atomic_ptrdiff_t;
+
+
+#define ATOMIC_VAR_INIT(_VI) { _VI }
+
+  template<typename _Tp>
+    struct atomic;
+
+  template<typename _Tp>
+    struct atomic<_Tp*>;
+
+  // @} group atomics
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.h
new file mode 100644
index 0000000..29d8ae5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.h
@@ -0,0 +1,475 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/basic_ios.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+#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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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
+       *  <code>if (!a_stream) ...</code> and <code>while (a_stream) ...</code>
+      */
+      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 @a 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 @a 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_VERSION
+} // namespace
+
+#include <bits/basic_ios.tcc>
+
+#endif /* _BASIC_IOS_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.tcc
new file mode 100644
index 0000000..8ac6bfd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.tcc
@@ -0,0 +1,189 @@
+// basic_ios member functions -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2009, 2010, 2011  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/basic_ios.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+#ifndef _BASIC_IOS_TCC
+#define _BASIC_IOS_TCC 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.h
new file mode 100644
index 0000000..2f708b7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.h
@@ -0,0 +1,3036 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/basic_string.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{string}
+ */
+
+//
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @class basic_string basic_string.h <string>
+   *  @brief  Managing sequences of characters and character-like objects.
+   *
+   *  @ingroup strings
+   *  @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 @c %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 @a 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 <em>empty string</em> _Rep object already @a 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)
+	{
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+	  if (__builtin_expect(this != &_S_empty_rep(), false))
+#endif
+	    {
+	      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
+	    {
+	      // Be race-detector-friendly.  For more info see bits/c++config.
+	      _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
+	      if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
+							 -1) <= 0)
+		{
+		  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
+		  _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.
+       */
+      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
+
+      /**
+       *  @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, &apos;\\0&apos;
+       *  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  Move construct string.
+       *  @param  str  Source string.
+       *
+       *  The newly-created string contains the exact contents of @a str.
+       *  @a str is a valid, but unspecified string.
+       **/
+      basic_string(basic_string&& __str)
+      : _M_dataplus(__str._M_dataplus)
+      {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING	
+	__str._M_data(_S_empty_rep()._M_refdata());
+#else
+	__str._M_data(_S_construct(size_type(), _CharT(), get_allocator()));
+#endif
+      }
+
+      /**
+       *  @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  Move assign the value of @a str to this string.
+       *  @param  str  Source string.
+       *
+       *  The contents of @a str are moved into this string (without copying).
+       *  @a str is a valid, but unspecified string.
+       **/
+      basic_string&
+      operator=(basic_string&& __str)
+      {
+	// NB: DR 1204.
+	this->swap(__str);
+	return *this;
+      }
+
+      /**
+       *  @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.size());
+	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()); }
+
+#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 _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()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      ///  A non-binding request to reduce capacity() to size().
+      void
+      shrink_to_fit()
+      {
+	__try
+	  { reserve(0); }
+	__catch(...)
+	  { }
+      }
+#endif
+
+      /**
+       *  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 
+       *  <code>*this == ""</code>.
+       */
+      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];
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  Returns a read/write reference to the data at the first
+       *  element of the %string.
+       */
+      reference
+      front()
+      { return operator[](0); }
+
+      /**
+       *  Returns a read-only (constant) reference to the data at the first
+       *  element of the %string.
+       */
+      const_reference
+      front() const
+      { return operator[](0); }
+
+      /**
+       *  Returns a read/write reference to the data at the last
+       *  element of the %string.
+       */
+      reference
+      back()
+      { return operator[](this->size() - 1); }
+
+      /**
+       *  Returns a read-only (constant) reference to the data at the
+       *  last element of the %string.
+       */
+      const_reference
+      back() const
+      { return operator[](this->size() - 1); }
+#endif
+
+      /**
+       *  @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.size()); }
+#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.size()); }
+#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);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Set value to contents of another string.
+       *  @param  str  Source string to use.
+       *  @return  Reference to this string.
+       *
+       *  This function sets this string to the exact contents of @a str.
+       *  @a str is a valid, but unspecified string.
+       */
+      basic_string&
+      assign(basic_string&& __str)
+      {
+	this->swap(__str);
+	return *this;
+      }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+      /**
+       *  @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.size()); }
+#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)
+      {
+	_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
+	this->insert(__p - _M_ibegin(), __l.begin(), __l.size());
+      }
+#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);
+ 
+      /**
+       *  @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 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_aux_2(static_cast<size_type>(__beg),
+				    __end, __a); }
+
+      static _CharT*
+      _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a)
+      { return _S_construct(__req, __c, __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, &apos;\\0&apos; 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>
+    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;
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
+	      const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+    { return std::move(__lhs.append(__rhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+	      basic_string<_CharT, _Traits, _Alloc>&& __rhs)
+    { return std::move(__rhs.insert(0, __lhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
+	      basic_string<_CharT, _Traits, _Alloc>&& __rhs)
+    {
+      const auto __size = __lhs.size() + __rhs.size();
+      const bool __cond = (__size > __lhs.capacity()
+			   && __size <= __rhs.capacity());
+      return __cond ? std::move(__rhs.insert(0, __lhs))
+	            : std::move(__lhs.append(__rhs));
+    }
+
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(const _CharT* __lhs,
+	      basic_string<_CharT, _Traits, _Alloc>&& __rhs)
+    { return std::move(__rhs.insert(0, __lhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(_CharT __lhs,
+	      basic_string<_CharT, _Traits, _Alloc>&& __rhs)
+    { return std::move(__rhs.insert(0, 1, __lhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
+	      const _CharT* __rhs)
+    { return std::move(__lhs.append(__rhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc>
+    inline basic_string<_CharT, _Traits, _Alloc>
+    operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
+	      _CharT __rhs)
+    { return std::move(__lhs.append(1, __rhs)); }
+#endif
+
+  // 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 &apos;\n&apos; 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_VERSION
+} // namespace
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99) \
+     && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
+
+#include <ext/string_conversions.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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.
+
+  // DR 1261.
+  inline string
+  to_string(int __val)
+  { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int),
+					   "%d", __val); }
+
+  inline string
+  to_string(unsigned __val)
+  { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
+					   4 * sizeof(unsigned),
+					   "%u", __val); }
+
+  inline string
+  to_string(long __val)
+  { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long),
+					   "%ld", __val); }
+
+  inline string
+  to_string(unsigned long __val)
+  { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
+					   4 * sizeof(unsigned long),
+					   "%lu", __val); }
+
+  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(float __val)
+  {
+    const int __n = 
+      __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
+					   "%f", __val);
+  }
+
+  inline string
+  to_string(double __val)
+  {
+    const int __n = 
+      __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
+					   "%f", __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); }
+
+  // DR 1261.
+  inline wstring
+  to_wstring(int __val)
+  { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(int),
+					    L"%d", __val); }
+
+  inline wstring
+  to_wstring(unsigned __val)
+  { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
+					    4 * sizeof(unsigned),
+					    L"%u", __val); }
+
+  inline wstring
+  to_wstring(long __val)
+  { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 * sizeof(long),
+					    L"%ld", __val); }
+
+  inline wstring
+  to_wstring(unsigned long __val)
+  { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
+					    4 * sizeof(unsigned long),
+					    L"%lu", __val); }
+
+  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(float __val)
+  {
+    const int __n =
+      __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
+					    L"%f", __val);
+  }
+
+  inline wstring
+  to_wstring(double __val)
+  {
+    const int __n =
+      __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
+					    L"%f", __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_VERSION
+} // namespace
+
+#endif /* __GXX_EXPERIMENTAL_CXX0X__ && _GLIBCXX_USE_C99 ... */
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // DR 1182.
+
+#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
+  /// std::hash specialization for string.
+  template<>
+    struct hash<string>
+    : public __hash_base<size_t, string>
+    {
+      size_t
+      operator()(const string& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(), __s.length()); }
+    };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  /// std::hash specialization for wstring.
+  template<>
+    struct hash<wstring>
+    : public __hash_base<size_t, wstring>
+    {
+      size_t
+      operator()(const wstring& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(),
+                                     __s.length() * sizeof(wchar_t)); }
+    };
+#endif
+#endif /* _GLIBCXX_COMPATIBILITY_CXX0X */
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+  /// std::hash specialization for u16string.
+  template<>
+    struct hash<u16string>
+    : public __hash_base<size_t, u16string>
+    {
+      size_t
+      operator()(const u16string& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(),
+                                     __s.length() * sizeof(char16_t)); }
+    };
+
+  /// std::hash specialization for u32string.
+  template<>
+    struct hash<u32string>
+    : public __hash_base<size_t, u32string>
+    {
+      size_t
+      operator()(const u32string& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(),
+                                     __s.length() * sizeof(char32_t)); }
+    };
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* __GXX_EXPERIMENTAL_CXX0X__ */
+
+#endif /* _BASIC_STRING_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.tcc
new file mode 100644
index 0000000..d988334
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.tcc
@@ -0,0 +1,1168 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/basic_string.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{string}
+ */
+
+//
+// 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 <bits/cxxabi_forced.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)
+	  __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>
+     typename basic_string<_CharT, _Traits, _Alloc>::iterator
+     basic_string<_CharT, _Traits, _Alloc>::
+     erase(iterator __first, iterator __last)
+     {
+       _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
+				&& __last <= _M_iend());
+
+       // NB: This isn't just an optimization (bail out early when
+       // there is nothing to do, really), it's also a correctness
+       // issue vs MT, see libstdc++/40518.
+       const size_type __size = __last - __first;
+       if (__size)
+	 {
+	   const size_type __pos = __first - _M_ibegin();
+	   _M_mutate(__pos, __size, size_type(0));
+	   _M_rep()->_M_set_leaked();
+	   return iterator(_M_data() + __pos);
+	 }
+       else
+	 return __first;
+     }
+
+   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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/boost_concept_check.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/boost_concept_check.h
new file mode 100644
index 0000000..f1bc16a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/boost_concept_check.h
@@ -0,0 +1,791 @@
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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 bits/boost_concept_check.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ */
+
+// 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 <bits/c++config.h>
+#include <bits/stl_iterator_base_types.h>    // for traits and tags
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#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_VERSION
+} // namespace
+
+#undef _IsUnused
+
+#endif // _GLIBCXX_BOOST_CONCEPT_CHECK
+
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/c++0x_warning.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/c++0x_warning.h
new file mode 100644
index 0000000..eb072d0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/c++0x_warning.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++0x_warning.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _CXX0X_WARNING_H
+#define _CXX0X_WARNING_H 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#error This file requires compiler and library support for the \
+ISO C++ 2011 standard. This support is currently experimental, and must be \
+enabled with the -std=c++11 or -std=gnu++11 compiler options.
+#endif
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/char_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/char_traits.h
new file mode 100644
index 0000000..07251df
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/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, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/char_traits.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{string}
+ */
+
+//
+// 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.
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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 @a 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 _GLIBCXX_CONSTEXPR bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR char_type
+      to_char_type(const int_type& __c)
+      { return static_cast<char_type>(__c); }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      to_int_type(const char_type& __c)
+      { return static_cast<int_type>(__c); }
+
+      static _GLIBCXX_CONSTEXPR bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      eof()
+      { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
+
+      static _GLIBCXX_CONSTEXPR 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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 @a 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 _GLIBCXX_CONSTEXPR bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR int_type
+      to_int_type(const char_type& __c)
+      { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
+
+      static _GLIBCXX_CONSTEXPR bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      eof()
+      { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR char_type
+      to_char_type(const int_type& __c)
+      { return char_type(__c); }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      to_int_type(const char_type& __c)
+      { return int_type(__c); }
+
+      static _GLIBCXX_CONSTEXPR bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      eof()
+      { return static_cast<int_type>(WEOF); }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      not_eof(const int_type& __c)
+      { return eq_int_type(__c, eof()) ? 0 : __c; }
+  };
+#endif //_GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+     && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+#include <cstdint>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 _GLIBCXX_CONSTEXPR bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR char_type
+      to_char_type(const int_type& __c)
+      { return char_type(__c); }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      to_int_type(const char_type& __c)
+      { return int_type(__c); }
+
+      static _GLIBCXX_CONSTEXPR bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      eof()
+      { return static_cast<int_type>(-1); }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR char_type
+      to_char_type(const int_type& __c)
+      { return char_type(__c); }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      to_int_type(const char_type& __c)
+      { return int_type(__c); }
+
+      static _GLIBCXX_CONSTEXPR bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      eof()
+      { return static_cast<int_type>(-1); }
+
+      static _GLIBCXX_CONSTEXPR int_type
+      not_eof(const int_type& __c)
+      { return eq_int_type(__c, eof()) ? 0 : __c; }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif 
+
+#endif // _CHAR_TRAITS_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/codecvt.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/codecvt.h
new file mode 100644
index 0000000..6ae9bbe
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/codecvt.h
@@ -0,0 +1,506 @@
+// Locale support (codecvt) -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// 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  Primary class template codecvt.
+   *  @ingroup locales
+   *
+   *  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.
+#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_VERSION
+} // namespace std
+
+#endif // _CODECVT_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/concept_check.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/concept_check.h
new file mode 100644
index 0000000..9517e5c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/concept_check.h
@@ -0,0 +1,80 @@
+// Concept-checking control -*- C++ -*-
+
+// Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/concept_check.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ */
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cpp_type_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cpp_type_traits.h
new file mode 100644
index 0000000..166890f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cpp_type_traits.h
@@ -0,0 +1,425 @@
+// The  -*- C++ -*- type traits classes for internal use in libstdc++
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cpp_type_traits.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/type_traits}
+ */
+
+// 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.
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _Iterator, typename _Container>
+    class __normal_iterator;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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; <em>long long</em> and <em>unsigned long long</em> 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_VERSION
+} // namespace
+
+#endif //_CPP_TYPE_TRAITS_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cxxabi_forced.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cxxabi_forced.h
new file mode 100644
index 0000000..c45ce79
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cxxabi_forced.h
@@ -0,0 +1,60 @@
+// cxxabi.h subset for cancellation -*- C++ -*-
+  
+// Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+// 
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cxxabi_forced.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{cxxabi.h}
+ */
+
+#ifndef _CXXABI_FORCED_H
+#define _CXXABI_FORCED_H 1
+
+#pragma GCC system_header
+
+#pragma GCC visibility push(default)
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{  
+  /** 
+   *  @brief Thrown as part of forced unwinding.
+   *  @ingroup exceptions
+   *
+   *  A magic placeholder class that can be caught by reference to
+   *  recognize forced unwinding.
+   */
+  class __forced_unwind
+  {
+    virtual ~__forced_unwind() throw();
+
+    // Prevent catch by value.
+    virtual void __pure_dummy() = 0; 
+  };
+}
+#endif // __cplusplus
+
+#pragma GCC visibility pop
+
+#endif // __CXXABI_FORCED_H 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/deque.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/deque.tcc
new file mode 100644
index 0000000..6381022
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/deque.tcc
@@ -0,0 +1,1048 @@
+// Deque implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/deque.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{deque}
+ */
+
+#ifndef _DEQUE_TCC
+#define _DEQUE_TCC 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template <typename _Tp, typename _Alloc>
+    void
+    deque<_Tp, _Alloc>::
+    _M_default_initialize()
+    {
+      _Map_pointer __cur;
+      __try
+        {
+          for (__cur = this->_M_impl._M_start._M_node;
+	       __cur < this->_M_impl._M_finish._M_node;
+	       ++__cur)
+            std::__uninitialized_default_a(*__cur, *__cur + _S_buffer_size(),
+					   _M_get_Tp_allocator());
+          std::__uninitialized_default_a(this->_M_impl._M_finish._M_first,
+					 this->_M_impl._M_finish._M_cur,
+					 _M_get_Tp_allocator());
+        }
+      __catch(...)
+        {
+          std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),
+			_M_get_Tp_allocator());
+          __throw_exception_again;
+        }
+    }
+#endif
+
+  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 == __last)
+	return __first;
+      else 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);
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template <typename _Tp, typename _Alloc>
+    void
+    deque<_Tp, _Alloc>::
+    _M_default_append(size_type __n)
+    {
+      if (__n)
+	{
+	  iterator __new_finish = _M_reserve_elements_at_back(__n);
+	  __try
+	    {
+	      std::__uninitialized_default_a(this->_M_impl._M_finish,
+					     __new_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;
+	    }
+	}
+    }
+#endif
+
+  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".
+  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);
+    }
+
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
+	 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    {
+      typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
+      typedef typename _Self::difference_type difference_type;
+
+      difference_type __len = __last - __first;
+      while (__len > 0)
+	{
+	  const difference_type __clen
+	    = std::min(__len, std::min(__first._M_last - __first._M_cur,
+				       __result._M_last - __result._M_cur));
+	  std::copy(__first._M_cur, __first._M_cur + __clen, __result._M_cur);
+	  __first += __clen;
+	  __result += __clen;
+	  __len -= __clen;
+	}
+      return __result;
+    }
+
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
+		  _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    {
+      typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
+      typedef typename _Self::difference_type difference_type;
+
+      difference_type __len = __last - __first;
+      while (__len > 0)
+	{
+	  difference_type __llen = __last._M_cur - __last._M_first;
+	  _Tp* __lend = __last._M_cur;
+
+	  difference_type __rlen = __result._M_cur - __result._M_first;
+	  _Tp* __rend = __result._M_cur;
+
+	  if (!__llen)
+	    {
+	      __llen = _Self::_S_buffer_size();
+	      __lend = *(__last._M_node - 1) + __llen;
+	    }
+	  if (!__rlen)
+	    {
+	      __rlen = _Self::_S_buffer_size();
+	      __rend = *(__result._M_node - 1) + __rlen;
+	    }
+
+	  const difference_type __clen = std::min(__len,
+						  std::min(__llen, __rlen));
+	  std::copy_backward(__lend - __clen, __lend, __rend);
+	  __last -= __clen;
+	  __result -= __clen;
+	  __len -= __clen;
+	}
+      return __result;
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    move(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
+	 _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    {
+      typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
+      typedef typename _Self::difference_type difference_type;
+
+      difference_type __len = __last - __first;
+      while (__len > 0)
+	{
+	  const difference_type __clen
+	    = std::min(__len, std::min(__first._M_last - __first._M_cur,
+				       __result._M_last - __result._M_cur));
+	  std::move(__first._M_cur, __first._M_cur + __clen, __result._M_cur);
+	  __first += __clen;
+	  __result += __clen;
+	  __len -= __clen;
+	}
+      return __result;
+    }
+
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*> __first,
+		  _Deque_iterator<_Tp, const _Tp&, const _Tp*> __last,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    {
+      typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
+      typedef typename _Self::difference_type difference_type;
+
+      difference_type __len = __last - __first;
+      while (__len > 0)
+	{
+	  difference_type __llen = __last._M_cur - __last._M_first;
+	  _Tp* __lend = __last._M_cur;
+
+	  difference_type __rlen = __result._M_cur - __result._M_first;
+	  _Tp* __rend = __result._M_cur;
+
+	  if (!__llen)
+	    {
+	      __llen = _Self::_S_buffer_size();
+	      __lend = *(__last._M_node - 1) + __llen;
+	    }
+	  if (!__rlen)
+	    {
+	      __rlen = _Self::_S_buffer_size();
+	      __rend = *(__result._M_node - 1) + __rlen;
+	    }
+
+	  const difference_type __clen = std::min(__len,
+						  std::min(__llen, __rlen));
+	  std::move_backward(__lend - __clen, __lend, __rend);
+	  __last -= __clen;
+	  __result -= __clen;
+	  __len -= __clen;
+	}
+      return __result;
+    }
+#endif
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_defines.h
new file mode 100644
index 0000000..269937c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_defines.h
@@ -0,0 +1,47 @@
+// -fno-exceptions Support -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2006, 2007, 2008, 2009,
+// 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/exception_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{exception}
+ */
+
+#ifndef _EXCEPTION_DEFINES_H
+#define _EXCEPTION_DEFINES_H 1
+
+#ifndef __EXCEPTIONS
+// Iff -fno-exceptions, transform error handling code to work without it.
+# define __try      if (true)
+# define __catch(X) if (false)
+# define __throw_exception_again
+#else
+// Else proceed normally.
+# define __try      try
+# define __catch(X) catch(X)
+# define __throw_exception_again throw
+#endif
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_ptr.h
new file mode 100644
index 0000000..26117cd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_ptr.h
@@ -0,0 +1,191 @@
+// Exception Handling support header (exception_ptr class) for -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+// 
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/exception_ptr.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{exception}
+ */
+
+#ifndef _EXCEPTION_PTR_H
+#define _EXCEPTION_PTR_H
+
+#pragma GCC visibility push(default)
+
+#include <bits/c++config.h>
+#include <bits/exception_defines.h>
+
+#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+#  error This platform does not support exception propagation.
+#endif
+
+extern "C++" {
+
+namespace std 
+{
+  /**
+   * @addtogroup exceptions
+   * @{
+   */
+  namespace __exception_ptr
+  {
+    class exception_ptr;
+  }
+
+  using __exception_ptr::exception_ptr;
+
+  /** Obtain an exception_ptr to the currently handled exception. If there
+   *  is none, or the currently handled exception is foreign, return the null
+   *  value.
+   */
+  exception_ptr current_exception() throw();
+
+  /// Throw the object pointed to by the exception_ptr.
+  void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__));
+
+  namespace __exception_ptr
+  {
+    /**
+     *  @brief An opaque pointer to an arbitrary exception.
+     *  @ingroup exceptions
+     */
+    class exception_ptr
+    {
+      void* _M_exception_object;
+
+      explicit exception_ptr(void* __e) throw();
+
+      void _M_addref() throw();
+      void _M_release() throw();
+
+      void *_M_get() const throw() __attribute__ ((__pure__));
+
+      friend exception_ptr std::current_exception() throw();
+      friend void std::rethrow_exception(exception_ptr);
+
+    public:
+      exception_ptr() throw();
+
+      exception_ptr(const exception_ptr&) throw();
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      exception_ptr(nullptr_t) throw()
+      : _M_exception_object(0)
+      { }
+
+      exception_ptr(exception_ptr&& __o) throw()
+      : _M_exception_object(__o._M_exception_object)
+      { __o._M_exception_object = 0; }
+#else
+      typedef void (exception_ptr::*__safe_bool)();
+
+      // For construction from nullptr or 0.
+      exception_ptr(__safe_bool) throw();
+#endif
+
+      exception_ptr& 
+      operator=(const exception_ptr&) throw();
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      exception_ptr& 
+      operator=(exception_ptr&& __o) throw()
+      {
+        exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this);
+        return *this;
+      }
+#endif
+
+      ~exception_ptr() throw();
+
+      void 
+      swap(exception_ptr&) throw();
+
+#ifdef _GLIBCXX_EH_PTR_COMPAT
+      // Retained for compatibility with CXXABI_1.3.
+      void _M_safe_bool_dummy() throw() __attribute__ ((__const__));
+      bool operator!() const throw() __attribute__ ((__pure__));
+      operator __safe_bool() const throw();
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit operator bool() const
+      { return _M_exception_object; }
+#endif
+
+      friend bool 
+      operator==(const exception_ptr&, const exception_ptr&) throw() 
+      __attribute__ ((__pure__));
+
+      const class type_info*
+      __cxa_exception_type() const throw() __attribute__ ((__pure__));
+    };
+
+    bool 
+    operator==(const exception_ptr&, const exception_ptr&) throw() 
+    __attribute__ ((__pure__));
+
+    bool 
+    operator!=(const exception_ptr&, const exception_ptr&) throw() 
+    __attribute__ ((__pure__));
+
+    inline void
+    swap(exception_ptr& __lhs, exception_ptr& __rhs)
+    { __lhs.swap(__rhs); }
+
+  } // namespace __exception_ptr
+
+
+  /// Obtain an exception_ptr pointing to a copy of the supplied object.
+  template<typename _Ex>
+    exception_ptr 
+    copy_exception(_Ex __ex) throw()
+    {
+      __try
+	{
+#ifdef __EXCEPTIONS
+	  throw __ex;
+#endif
+	}
+      __catch(...)
+	{
+	  return current_exception();
+	}
+    }
+
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 1130. copy_exception name misleading
+  /// Obtain an exception_ptr pointing to a copy of the supplied object.
+  template<typename _Ex>
+    exception_ptr 
+    make_exception_ptr(_Ex __ex) throw()
+    { return std::copy_exception<_Ex>(__ex); }
+
+  // @} group exceptions
+} // namespace std
+
+} // extern "C++"
+
+#pragma GCC visibility pop
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.h
new file mode 100644
index 0000000..39c2532
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.h
@@ -0,0 +1,1303 @@
+// <forward_list.h> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/forward_list.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{forward_list}
+ */
+
+#ifndef _FORWARD_LIST_H
+#define _FORWARD_LIST_H 1
+
+#pragma GCC system_header
+
+#include <memory>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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.
+   */
+  struct _Fwd_list_node_base
+  {
+    _Fwd_list_node_base() : _M_next(0) { }
+
+    _Fwd_list_node_base* _M_next;
+
+    _Fwd_list_node_base*
+    _M_transfer_after(_Fwd_list_node_base* __begin)
+    {
+      _Fwd_list_node_base* __end = __begin;
+      while (__end && __end->_M_next)
+	__end = __end->_M_next;
+      return _M_transfer_after(__begin, __end);
+    }
+
+    _Fwd_list_node_base*
+    _M_transfer_after(_Fwd_list_node_base* __begin,
+		      _Fwd_list_node_base* __end)
+    {
+      _Fwd_list_node_base* __keep = __begin->_M_next;
+      if (__end)
+	{
+	  __begin->_M_next = __end->_M_next;
+	  __end->_M_next = _M_next;
+	}
+      else
+	__begin->_M_next = 0;
+      _M_next = __keep;
+      return __end;
+    }
+
+    void
+    _M_reverse_after()
+    {
+      _Fwd_list_node_base* __tail = _M_next;
+      if (!__tail)
+	return;
+      while (_Fwd_list_node_base* __temp = __tail->_M_next)
+	{
+	  _Fwd_list_node_base* __keep = _M_next;
+	  _M_next = __temp;
+	  __tail->_M_next = __temp->_M_next;
+	  _M_next->_M_next = __keep;
+	}
+    }
+  };
+
+  /**
+   *  @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>
+    struct _Fwd_list_node
+    : public _Fwd_list_node_base
+    {
+      template<typename... _Args>
+        _Fwd_list_node(_Args&&... __args)
+        : _Fwd_list_node_base(), 
+          _M_value(std::forward<_Args>(__args)...) { }
+
+      _Tp _M_value;
+    };
+
+  /**
+   *   @brief A forward_list::iterator.
+   * 
+   *   All the functions are op overloads.
+   */
+  template<typename _Tp>
+    struct _Fwd_list_iterator
+    {
+      typedef _Fwd_list_iterator<_Tp>            _Self;
+      typedef _Fwd_list_node<_Tp>                _Node;
+
+      typedef _Tp                                value_type;
+      typedef _Tp*                               pointer;
+      typedef _Tp&                               reference;
+      typedef ptrdiff_t                          difference_type;
+      typedef std::forward_iterator_tag          iterator_category;
+
+      _Fwd_list_iterator()
+      : _M_node() { }
+
+      explicit
+      _Fwd_list_iterator(_Fwd_list_node_base* __n) 
+      : _M_node(__n) { }
+
+      reference
+      operator*() const
+      { return static_cast<_Node*>(this->_M_node)->_M_value; }
+
+      pointer
+      operator->() const
+      { return std::__addressof(static_cast<_Node*>
+				(this->_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);
+      }
+
+      _Fwd_list_node_base* _M_node;
+    };
+
+  /**
+   *   @brief A forward_list::const_iterator.
+   * 
+   *   All the functions are op overloads.
+   */
+  template<typename _Tp>
+    struct _Fwd_list_const_iterator
+    {
+      typedef _Fwd_list_const_iterator<_Tp>      _Self;
+      typedef const _Fwd_list_node<_Tp>          _Node;
+      typedef _Fwd_list_iterator<_Tp>            iterator;
+
+      typedef _Tp                                value_type;
+      typedef const _Tp*                         pointer;
+      typedef const _Tp&                         reference;
+      typedef ptrdiff_t                          difference_type;
+      typedef std::forward_iterator_tag          iterator_category;
+
+      _Fwd_list_const_iterator()
+      : _M_node() { }
+
+      explicit
+      _Fwd_list_const_iterator(const _Fwd_list_node_base* __n) 
+      : _M_node(__n) { }
+
+      _Fwd_list_const_iterator(const iterator& __iter)
+      : _M_node(__iter._M_node) { }
+
+      reference
+      operator*() const
+      { return static_cast<_Node*>(this->_M_node)->_M_value; }
+
+      pointer
+      operator->() const
+      { return std::__addressof(static_cast<_Node*>
+				(this->_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);
+      }
+
+      const _Fwd_list_node_base* _M_node;
+    };
+
+  /**
+   *  @brief  Forward list iterator equality comparison.
+   */
+  template<typename _Tp>
+    inline bool
+    operator==(const _Fwd_list_iterator<_Tp>& __x,
+               const _Fwd_list_const_iterator<_Tp>& __y)
+    { return __x._M_node == __y._M_node; }
+
+  /**
+   *  @brief  Forward list iterator inequality comparison.
+   */
+  template<typename _Tp>
+    inline bool
+    operator!=(const _Fwd_list_iterator<_Tp>& __x,
+               const _Fwd_list_const_iterator<_Tp>& __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>>::other _Node_alloc_type;
+
+      struct _Fwd_list_impl 
+      : public _Node_alloc_type
+      {
+        _Fwd_list_node_base _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>                 iterator;
+      typedef _Fwd_list_const_iterator<_Tp>           const_iterator;
+      typedef _Fwd_list_node<_Tp>                     _Node;
+
+      _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() { }
+
+      _Fwd_list_base(const _Alloc& __a)
+      : _M_impl(__a) { }
+
+      _Fwd_list_base(const _Fwd_list_base& __lst, const _Alloc& __a);
+
+      _Fwd_list_base(_Fwd_list_base&& __lst, const _Alloc& __a)
+      : _M_impl(__a)
+      {
+	this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next;
+	__lst._M_impl._M_head._M_next = 0;
+      }
+
+      _Fwd_list_base(_Fwd_list_base&& __lst)
+      : _M_impl(__lst._M_get_Node_allocator())
+      {
+	this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next;
+	__lst._M_impl._M_head._M_next = 0;
+      }
+
+      ~_Fwd_list_base()
+      { _M_erase_after(&_M_impl._M_head, 0); }
+
+    protected:
+
+      _Node*
+      _M_get_node()
+      { return _M_get_Node_allocator().allocate(1); }
+
+      template<typename... _Args>
+        _Node*
+        _M_create_node(_Args&&... __args)
+        {
+          _Node* __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>
+        _Fwd_list_node_base*
+        _M_insert_after(const_iterator __pos, _Args&&... __args);
+
+      void
+      _M_put_node(_Node* __p)
+      { _M_get_Node_allocator().deallocate(__p, 1); }
+
+      _Fwd_list_node_base*
+      _M_erase_after(_Fwd_list_node_base* __pos);
+
+      _Fwd_list_node_base*
+      _M_erase_after(_Fwd_list_node_base* __pos, 
+                     _Fwd_list_node_base* __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 _Fwd_list_node<_Tp>                          _Node;
+      typedef _Fwd_list_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 _Fwd_list_iterator<_Tp>                      iterator;
+      typedef _Fwd_list_const_iterator<_Tp>                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::move(__list), __al)
+      { }
+
+      /**
+       *  @brief  Creates a %forward_list with default constructed elements.
+       *  @param  n  The number of elements to initially create.
+       *
+       *  This constructor creates the %forward_list with @a n default
+       *  constructed elements.
+       */
+      explicit
+      forward_list(size_type __n)
+      : _Base()
+      { _M_default_initialize(__n); }
+
+      /**
+       *  @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._M_get_Node_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::move(__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()
+      { }
+
+      /**
+       *  @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)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	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_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_cast<_Node*>(this->_M_impl._M_head._M_next);
+        return __front->_M_value;
+      }
+
+      // 23.2.3.4 modiﬁers:
+
+      /**
+       *  @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.
+       *  @return  An iterator pointing to the last inserted copy of
+       *           @a val or @a pos if @a n == 0.
+       *
+       *  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.
+       */
+      iterator
+      insert_after(const_iterator __pos, size_type __n, const _Tp& __val);
+
+      /**
+       *  @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.
+       *  @return  An iterator pointing to the last inserted element or
+       *           @a pos if @a first == @a last.
+       *
+       *  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>
+        iterator
+        insert_after(const_iterator __pos,
+                     _InputIterator __first, _InputIterator __last);
+
+      /**
+       *  @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.
+       *  @return  An iterator pointing to the last inserted element
+       *           or @a pos if @a il is empty.
+       *
+       *  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.
+       */
+      iterator
+      insert_after(const_iterator __pos, std::initializer_list<_Tp> __il);
+
+      /**
+       *  @brief  Removes the element pointed to by the iterator following
+       *          @c pos.
+       *  @param  pos  Iterator pointing before element to be erased.
+       *  @return  An iterator pointing to the element following the one
+       *           that was erased, or end() if no such element exists.
+       *
+       *  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)
+      { return iterator(this->_M_erase_after(const_cast<_Node_base*>
+					     (__pos._M_node))); }
+
+      /**
+       *  @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  @last.
+       *
+       *  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, const_iterator __last)
+      { return iterator(this->_M_erase_after(const_cast<_Node_base*>
+					     (__pos._M_node),
+					     const_cast<_Node_base*>
+					     (__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)
+      { std::swap(this->_M_impl._M_head._M_next,
+		  __list._M_impl._M_head._M_next); }
+
+      /**
+       *  @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 the new elements
+       *  are default constructed.
+       */
+      void
+      resize(size_type __sz);
+
+      /**
+       *  @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, const 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)
+      {
+	if (!__list.empty())
+	  _M_splice_after(__pos, std::move(__list));
+      }
+
+      /**
+       *  @brief  Insert element from another %forward_list.
+       *  @param  pos  Iterator referencing the element to insert after.
+       *  @param  list  Source list.
+       *  @param  i   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 __i)
+      {
+	const_iterator __j = __i;
+	++__j;
+	if (__pos == __i || __pos == __j)
+	  return;
+
+	splice_after(__pos, std::move(__list), __i, __j);
+      }
+
+      /**
+       *  @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(std::move(__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()
+      { this->sort(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);
+
+      /**
+       *  @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);
+
+      // Called by splice_after and insert_after.
+      iterator
+      _M_splice_after(const_iterator __pos, forward_list&& __list);
+
+      // Called by forward_list(n).
+      void
+      _M_default_initialize(size_type __n);
+
+      // Called by resize(sz).
+      void
+      _M_default_insert_after(const_iterator __pos, size_type __n);
+    };
+
+  /**
+   *  @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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif // _FORWARD_LIST_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.tcc
new file mode 100644
index 0000000..2c319db
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.tcc
@@ -0,0 +1,503 @@
+// <forward_list.tcc> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/forward_list.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{forward_list}
+ */
+
+#ifndef _FORWARD_LIST_TCC
+#define _FORWARD_LIST_TCC 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  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;
+      _Fwd_list_node_base* __to = &this->_M_impl._M_head;
+      _Node* __curr = static_cast<_Node*>(__lst._M_impl._M_head._M_next);
+
+      while (__curr)
+        {
+          __to->_M_next = _M_create_node(__curr->_M_value);
+          __to = __to->_M_next;
+          __curr = static_cast<_Node*>(__curr->_M_next);
+        }
+    }
+
+  template<typename _Tp, typename _Alloc>
+    template<typename... _Args>
+      _Fwd_list_node_base*
+      _Fwd_list_base<_Tp, _Alloc>::
+      _M_insert_after(const_iterator __pos, _Args&&... __args)
+      {
+        _Fwd_list_node_base* __to
+	  = const_cast<_Fwd_list_node_base*>(__pos._M_node);
+	_Node* __thing = _M_create_node(std::forward<_Args>(__args)...);
+        __thing->_M_next = __to->_M_next;
+        __to->_M_next = __thing;
+        return __to->_M_next;
+      }
+
+  template<typename _Tp, typename _Alloc>
+    _Fwd_list_node_base*
+    _Fwd_list_base<_Tp, _Alloc>::
+    _M_erase_after(_Fwd_list_node_base* __pos)
+    {
+      _Node* __curr = static_cast<_Node*>(__pos->_M_next);
+      __pos->_M_next = __curr->_M_next;
+      _M_get_Node_allocator().destroy(__curr);
+      _M_put_node(__curr);
+      return __pos->_M_next;
+    }
+
+  template<typename _Tp, typename _Alloc>
+    _Fwd_list_node_base*
+    _Fwd_list_base<_Tp, _Alloc>::
+    _M_erase_after(_Fwd_list_node_base* __pos, 
+                   _Fwd_list_node_base* __last)
+    {
+      _Node* __curr = static_cast<_Node*>(__pos->_M_next);
+      while (__curr != __last)
+        {
+          _Node* __temp = __curr;
+          __curr = static_cast<_Node*>(__curr->_M_next);
+          _M_get_Node_allocator().destroy(__temp);
+          _M_put_node(__temp);
+        }
+      __pos->_M_next = __last;
+      return __last;
+    }
+
+  // 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)
+      {
+        _Node_base* __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)
+    {
+      _Node_base* __to = &this->_M_impl._M_head;
+      for (; __n; --__n)
+        {
+          __to->_M_next = this->_M_create_node(__value);
+          __to = __to->_M_next;
+        }
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    _M_default_initialize(size_type __n)
+    {
+      _Node_base* __to = &this->_M_impl._M_head;
+      for (; __n; --__n)
+        {
+          __to->_M_next = this->_M_create_node();
+          __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>::
+    _M_default_insert_after(const_iterator __pos, size_type __n)
+    {
+      const_iterator __saved_pos = __pos;
+      __try
+	{
+	  for (; __n; --__n)
+	    __pos = emplace_after(__pos);
+	}
+      __catch(...)
+	{
+	  erase_after(__saved_pos, ++__pos);
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    resize(size_type __sz)
+    {
+      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
+	_M_default_insert_after(__k, __sz - __len);
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    resize(size_type __sz, const 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>
+    typename forward_list<_Tp, _Alloc>::iterator
+    forward_list<_Tp, _Alloc>::
+    _M_splice_after(const_iterator __pos, forward_list&& __list)
+    {
+      _Node_base* __tmp = const_cast<_Node_base*>(__pos._M_node);
+      iterator __before = __list.before_begin();
+      return iterator(__tmp->_M_transfer_after(__before._M_node));
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    splice_after(const_iterator __pos, forward_list&&,
+                 const_iterator __before, const_iterator __last)
+    {
+      _Node_base* __tmp = const_cast<_Node_base*>(__pos._M_node);
+      __tmp->_M_transfer_after(const_cast<_Node_base*>(__before._M_node),
+                               const_cast<_Node_base*>(__last._M_node));
+    }
+
+  template<typename _Tp, typename _Alloc>
+    typename forward_list<_Tp, _Alloc>::iterator
+    forward_list<_Tp, _Alloc>::
+    insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
+    {
+      if (__n)
+	{
+	  forward_list __tmp(__n, __val, this->_M_get_Node_allocator());
+	  return _M_splice_after(__pos, std::move(__tmp));
+	}
+      else
+	return iterator(const_cast<_Node_base*>(__pos._M_node));
+    }
+
+  template<typename _Tp, typename _Alloc>
+    template<typename _InputIterator>
+      typename forward_list<_Tp, _Alloc>::iterator
+      forward_list<_Tp, _Alloc>::
+      insert_after(const_iterator __pos,
+		   _InputIterator __first, _InputIterator __last)
+      {
+	forward_list __tmp(__first, __last, this->_M_get_Node_allocator());
+	if (!__tmp.empty())
+	  return _M_splice_after(__pos, std::move(__tmp));
+	else
+	  return iterator(const_cast<_Node_base*>(__pos._M_node));
+      }
+
+  template<typename _Tp, typename _Alloc>
+    typename forward_list<_Tp, _Alloc>::iterator
+    forward_list<_Tp, _Alloc>::
+    insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
+    {
+      if (__il.size())
+	{
+	  forward_list __tmp(__il, this->_M_get_Node_allocator());
+	  return _M_splice_after(__pos, std::move(__tmp));
+	}
+      else
+	return iterator(const_cast<_Node_base*>(__pos._M_node));
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    remove(const _Tp& __val)
+    {
+      _Node* __curr = static_cast<_Node*>(&this->_M_impl._M_head);
+      _Node* __extra = 0;
+
+      while (_Node* __tmp = static_cast<_Node*>(__curr->_M_next))
+        {
+          if (__tmp->_M_value == __val)
+	    {
+	      if (std::__addressof(__tmp->_M_value)
+		  != std::__addressof(__val))
+		{
+		  this->_M_erase_after(__curr);
+		  continue;
+		}
+	      else
+		__extra = __curr;
+	    }
+	  __curr = static_cast<_Node*>(__curr->_M_next);
+        }
+
+      if (__extra)
+	this->_M_erase_after(__extra);
+    }
+
+  template<typename _Tp, typename _Alloc>
+    template<typename _Pred>
+      void
+      forward_list<_Tp, _Alloc>::
+      remove_if(_Pred __pred)
+      {
+	_Node* __curr = static_cast<_Node*>(&this->_M_impl._M_head);
+        while (_Node* __tmp = static_cast<_Node*>(__curr->_M_next))
+          {
+            if (__pred(__tmp->_M_value))
+              this->_M_erase_after(__curr);
+            else
+              __curr = static_cast<_Node*>(__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)
+      {
+        _Node_base* __node = &this->_M_impl._M_head;
+        while (__node->_M_next && __list._M_impl._M_head._M_next)
+          {
+            if (__comp(static_cast<_Node*>
+                       (__list._M_impl._M_head._M_next)->_M_value,
+                       static_cast<_Node*>
+                       (__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;
+    }
+
+  template<typename _Tp, class _Alloc>
+    template<typename _Comp>
+      void
+      forward_list<_Tp, _Alloc>::
+      sort(_Comp __comp)
+      {
+        // If `next' is 0, return immediately.
+        _Node* __list = static_cast<_Node*>(this->_M_impl._M_head._M_next);
+        if (!__list)
+          return;
+
+        unsigned long __insize = 1;
+
+        while (1)
+          {
+            _Node* __p = __list;
+            __list = 0;
+            _Node* __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.
+                _Node* __q = __p;
+                unsigned long __psize = 0;
+                for (unsigned long __i = 0; __i < __insize; ++__i)
+                  {
+                    ++__psize;
+                    __q = static_cast<_Node*>(__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.
+                    _Node* __e;
+                    if (__psize == 0)
+                      {
+                        // p is empty; e must come from q.
+                        __e = __q;
+                        __q = static_cast<_Node*>(__q->_M_next);
+                        --__qsize;
+                      }
+                    else if (__qsize == 0 || !__q)
+                      {
+                        // q is empty; e must come from p.
+                        __e = __p;
+                        __p = static_cast<_Node*>(__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_cast<_Node*>(__p->_M_next);
+                        --__psize;
+                      }
+                    else
+                      {
+                        // First node of q is lower; e must come from q.
+                        __e = __q;
+                        __q = static_cast<_Node*>(__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_impl._M_head._M_next = __list;
+                return;
+              }
+
+            // Otherwise repeat, merging lists twice the size.
+            __insize *= 2;
+          }
+      }
+ 
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _FORWARD_LIST_TCC */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/fstream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/fstream.tcc
new file mode 100644
index 0000000..3d5ca62
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/fstream.tcc
@@ -0,0 +1,984 @@
+// File based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/fstream.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{fstream}
+ */
+
+//
+// ISO C++ 14882: 27.8  File-based streams
+//
+
+#ifndef _FSTREAM_TCC
+#define _FSTREAM_TCC 1
+
+#pragma GCC system_header
+
+#include <bits/cxxabi_forced.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 = 0;
+	  _M_buf_allocated = false;
+	}
+      delete [] _M_ext_buf;
+      _M_ext_buf = 0;
+      _M_ext_buf_size = 0;
+      _M_ext_next = 0;
+      _M_ext_end = 0;
+    }
+
+  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(0), _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 = 0;
+      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 0;
+
+      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 0;
+      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)
+	{
+	  if (_M_writing)
+	    {
+	      if (overflow() == traits_type::eof())
+		return __ret;
+	      _M_set_buffer(-1);
+	      _M_writing = false;
+	    }
+	  // 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)
+	{
+	  if (_M_writing)
+	    {
+	      if (overflow() == traits_type::eof())
+		return __ret;
+	      _M_set_buffer(-1);
+	      _M_writing = false;
+	    }
+	  // 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)
+	{
+          if (_M_reading)
+            {
+              _M_destroy_pback();
+              const int __gptr_off = _M_get_ext_pos(_M_state_last);
+              if (_M_seek(__gptr_off, ios_base::cur, _M_state_last)
+                  == pos_type(off_type(-1)))
+                return __ret;
+            }
+	  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(); // emulate non-underflowing sbumpc
+	      this->gbump(1);
+	      __ret = 1;
+	      --__n;
+	    }
+	  _M_destroy_pback();
+	}
+      else if (_M_writing)
+	{
+ 	  if (overflow() == traits_type::eof())
+ 	    return __ret;
+ 	  _M_set_buffer(-1);
+ 	  _M_writing = false;
+ 	}
+ 
+      // 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)
+ 	 {
+ 	   // First, copy the chars already present in the buffer.
+ 	   const streamsize __avail = this->egptr() - this->gptr();
+ 	   if (__avail != 0)
+ 	     {
+	       traits_type::copy(__s, this->gptr(), __avail);
+ 	       __s += __avail;
+	       this->setg(this->eback(), this->gptr() + __avail,
+			  this->egptr());
+	       __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)
+    {
+      streamsize __ret = 0;
+      // 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.
+      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)
+	{
+	  // tellg and tellp queries do not affect any state, unless
+	  // ! always_noconv and the put sequence is not empty.
+	  // In that case, determining the position requires converting the
+	  // put sequence. That doesn't use ext_buf, so requires a flush.
+	  bool __no_movement = __way == ios_base::cur && __off == 0
+	    && (!_M_writing || _M_codecvt->always_noconv());
+
+	  // Ditch any pback buffers to avoid confusion.
+	  if (!__no_movement)
+	    _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)
+	    {
+	      __state = _M_state_last;
+	      __computed_off += _M_get_ext_pos(__state);
+	    }
+	  if (!__no_movement)
+	    __ret = _M_seek(__computed_off, __way, __state);
+	  else
+	    {
+	      if (_M_writing)
+		__computed_off = this->pptr() - this->pbase();
+	      
+ 	      off_type __file_off = _M_file.seekoff(0, ios_base::cur);
+ 	      if (__file_off != off_type(-1))
+		{
+		  __ret = __file_off + __computed_off;
+		  __ret.state(__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())
+	{
+	  off_type __file_off = _M_file.seekoff(__off, __way);
+	  if (__file_off != 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 = __file_off;
+	      __ret.state(_M_state_cur);
+	    }
+	}
+      return __ret;
+    }
+
+  // Returns the distance from the end of the ext buffer to the point
+  // corresponding to gptr(). This is a negative value. Updates __state
+  // from eback() correspondence to gptr().
+  template<typename _CharT, typename _Traits>
+    int basic_filebuf<_CharT, _Traits>::
+    _M_get_ext_pos(__state_type& __state)
+    {
+      if (_M_codecvt->always_noconv())
+        return this->gptr() - this->egptr();
+      else
+        {
+          // Calculate offset from _M_ext_buf that corresponds to
+          // gptr(). Precondition: __state == _M_state_last, which
+          // corresponds to eback().
+          const int __gptr_off =
+            _M_codecvt->length(__state, _M_ext_buf, _M_ext_next,
+                               this->gptr() - this->eback());
+          return _M_ext_buf + __gptr_off - _M_ext_end;
+        }
+    }
+    
+  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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functexcept.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functexcept.h
new file mode 100644
index 0000000..d8e6ae7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functexcept.h
@@ -0,0 +1,107 @@
+// Function-Based Exception Support -*- C++ -*-
+
+// Copyright (C) 2001, 2004, 2005, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/functexcept.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{exception}
+ *
+ *  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 <bits/exception_defines.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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__));
+
+  void
+  __throw_future_error(int) __attribute__((__noreturn__));
+
+  // Helpers for exception objects in <functional>
+  void
+  __throw_bad_function_call() __attribute__((__noreturn__));
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functional_hash.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functional_hash.h
new file mode 100644
index 0000000..e892159
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functional_hash.h
@@ -0,0 +1,205 @@
+// functional_hash.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{functional}
+ */
+
+#ifndef _FUNCTIONAL_HASH_H
+#define _FUNCTIONAL_HASH_H 1
+
+#pragma GCC system_header
+
+#include <bits/hash_bytes.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /** @defgroup hashes Hashes
+   *  @ingroup functors
+   *
+   *   Hashing functors taking a variable type and returning a @c std::size_t.
+   *
+   *  @{
+   */
+
+  template<typename _Result, typename _Arg>
+    struct __hash_base
+    {
+      typedef _Result     result_type;
+      typedef _Arg      argument_type;
+    };
+
+  /// Primary class template hash.
+  template<typename _Tp>
+    struct hash : public __hash_base<size_t, _Tp>
+    {
+      static_assert(sizeof(_Tp) < 0,
+		    "std::hash is not specialized for this type");
+      size_t operator()(const _Tp&) const noexcept;
+    };
+
+  /// Partial specializations for pointer types.
+  template<typename _Tp>
+    struct hash<_Tp*> : public __hash_base<size_t, _Tp*>
+    {
+      size_t
+      operator()(_Tp* __p) const noexcept
+      { return reinterpret_cast<size_t>(__p); }
+    };
+
+  // Explicit specializations for integer types.
+#define _Cxx_hashtable_define_trivial_hash(_Tp) 	\
+  template<>						\
+    struct hash<_Tp> : public __hash_base<size_t, _Tp>  \
+    {                                                   \
+      size_t                                            \
+      operator()(_Tp __val) const noexcept              \
+      { return static_cast<size_t>(__val); }            \
+    };
+
+  /// Explicit specialization for bool.
+  _Cxx_hashtable_define_trivial_hash(bool)
+
+  /// Explicit specialization for char.
+  _Cxx_hashtable_define_trivial_hash(char)
+
+  /// Explicit specialization for signed char.
+  _Cxx_hashtable_define_trivial_hash(signed char)
+
+  /// Explicit specialization for unsigned char.
+  _Cxx_hashtable_define_trivial_hash(unsigned char)
+
+  /// Explicit specialization for wchar_t.
+  _Cxx_hashtable_define_trivial_hash(wchar_t)
+
+  /// Explicit specialization for char16_t.
+  _Cxx_hashtable_define_trivial_hash(char16_t)
+
+  /// Explicit specialization for char32_t.
+  _Cxx_hashtable_define_trivial_hash(char32_t)
+
+  /// Explicit specialization for short.
+  _Cxx_hashtable_define_trivial_hash(short)
+
+  /// Explicit specialization for int.
+  _Cxx_hashtable_define_trivial_hash(int)
+
+  /// Explicit specialization for long.
+  _Cxx_hashtable_define_trivial_hash(long)
+
+  /// Explicit specialization for long long.
+  _Cxx_hashtable_define_trivial_hash(long long)
+
+  /// Explicit specialization for unsigned short.
+  _Cxx_hashtable_define_trivial_hash(unsigned short)
+
+  /// Explicit specialization for unsigned int.
+  _Cxx_hashtable_define_trivial_hash(unsigned int)
+
+  /// Explicit specialization for unsigned long.
+  _Cxx_hashtable_define_trivial_hash(unsigned long)
+
+  /// Explicit specialization for unsigned long long.
+  _Cxx_hashtable_define_trivial_hash(unsigned long long)
+
+#undef _Cxx_hashtable_define_trivial_hash
+
+  struct _Hash_impl
+  {
+    static size_t
+    hash(const void* __ptr, size_t __clength,
+	 size_t __seed = static_cast<size_t>(0xc70f6907UL))
+    { return _Hash_bytes(__ptr, __clength, __seed); }
+
+    template<typename _Tp>
+      static size_t
+      hash(const _Tp& __val)
+      { return hash(&__val, sizeof(__val)); }
+
+    template<typename _Tp>
+      static size_t
+      __hash_combine(const _Tp& __val, size_t __hash)
+      { return hash(&__val, sizeof(__val), __hash); }
+  };
+
+  struct _Fnv_hash_impl
+  {
+    static size_t
+    hash(const void* __ptr, size_t __clength,
+	 size_t __seed = static_cast<size_t>(2166136261UL))
+    { return _Fnv_hash_bytes(__ptr, __clength, __seed); }
+
+    template<typename _Tp>
+      static size_t
+      hash(const _Tp& __val)
+      { return hash(&__val, sizeof(__val)); }
+
+    template<typename _Tp>
+      static size_t
+      __hash_combine(const _Tp& __val, size_t __hash)
+      { return hash(&__val, sizeof(__val), __hash); }
+  };
+
+  /// Specialization for float.
+  template<>
+    struct hash<float> : public __hash_base<size_t, float>
+    {
+      size_t
+      operator()(float __val) const noexcept
+      {
+	// 0 and -0 both hash to zero.
+	return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
+      }
+    };
+
+  /// Specialization for double.
+  template<>
+    struct hash<double> : public __hash_base<size_t, double>
+    {
+      size_t
+      operator()(double __val) const noexcept
+      {
+	// 0 and -0 both hash to zero.
+	return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
+      }
+    };
+
+  /// Specialization for long double.
+  template<>
+    struct hash<long double>
+    : public __hash_base<size_t, long double>
+    {
+      _GLIBCXX_PURE size_t
+      operator()(long double __val) const noexcept;
+    };
+
+  // @} group hashes
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _FUNCTIONAL_HASH_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice.h
new file mode 100644
index 0000000..47d1775
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice.h
@@ -0,0 +1,185 @@
+// The template and inlines for the -*- C++ -*- gslice class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/gslice.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _GSLICE_H
+#define _GSLICE_H 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_VERSION
+} // namespace
+
+#endif /* _GSLICE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice_array.h
new file mode 100644
index 0000000..1ae047d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice_array.h
@@ -0,0 +1,219 @@
+// The template and inlines for the -*- C++ -*- gslice_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/gslice_array.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_VERSION
+} // namespace
+
+#endif /* _GSLICE_ARRAY_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hash_bytes.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hash_bytes.h
new file mode 100644
index 0000000..2f0c0ea
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hash_bytes.h
@@ -0,0 +1,59 @@
+// Declarations for hash functions. -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/hash_bytes.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{functional}
+ */
+
+#ifndef _HASH_BYTES_H
+#define _HASH_BYTES_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Hash function implementation for the nontrivial specialization.
+  // All of them are based on a primitive that hashes a pointer to a
+  // byte array. The actual hash algorithm is not guaranteed to stay
+  // the same from release to release -- it may be updated or tuned to
+  // improve hash quality or speed.
+  size_t
+  _Hash_bytes(const void* __ptr, size_t __len, size_t __seed);
+
+  // A similar hash primitive, using the FNV hash algorithm. This
+  // algorithm is guaranteed to stay the same from release to release.
+  // (although it might not produce the same values on different
+  // machines.)
+  size_t
+  _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed);
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable.h
new file mode 100644
index 0000000..8fdcfbf
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable.h
@@ -0,0 +1,1240 @@
+// hashtable.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{unordered_map, unordered_set}
+ */
+
+#ifndef _HASHTABLE_H
+#define _HASHTABLE_H 1
+
+#pragma GCC system_header
+
+#include <bits/hashtable_policy.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 __detail::_Equality_base<_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::pointer                pointer;
+      typedef typename _Allocator::const_pointer          const_pointer;
+      typedef typename _Allocator::reference              reference;
+      typedef typename _Allocator::const_reference        const_reference;
+
+      typedef std::size_t                                 size_type;
+      typedef std::ptrdiff_t                              difference_type;
+      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_begin_bucket_index; // First non-empty bucket.
+      size_type              _M_element_count;
+      _RehashPolicy          _M_rehash_policy;
+
+      template<typename... _Args>
+	_Node*
+	_M_allocate_node(_Args&&... __args);
+
+      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&);
+
+      _Hashtable(_Hashtable&&);
+
+      _Hashtable&
+      operator=(const _Hashtable& __ht)
+      {
+	_Hashtable __tmp(__ht);
+	this->swap(__tmp);
+	return *this;
+      }
+
+      _Hashtable&
+      operator=(_Hashtable&& __ht)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__ht);
+	return *this;
+      }
+
+      ~_Hashtable();
+
+      void swap(_Hashtable&);
+
+      // Basic container operations
+      iterator
+      begin()
+      { return iterator(_M_buckets + _M_begin_bucket_index); }
+
+      const_iterator
+      begin() const
+      { return const_iterator(_M_buckets + _M_begin_bucket_index); }
+
+      iterator
+      end()
+      { return iterator(_M_buckets + _M_bucket_count); }
+
+      const_iterator
+      end() const
+      { return const_iterator(_M_buckets + _M_bucket_count); }
+
+      const_iterator
+      cbegin() const
+      { return const_iterator(_M_buckets + _M_begin_bucket_index); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_M_buckets + _M_bucket_count); }
+
+      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); }
+
+      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); }
+
+      // 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); }
+
+      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 and insert helper functions and types
+      _Node*
+      _M_find_node(_Node*, const key_type&,
+		   typename _Hashtable::_Hash_code_type) const;
+
+      template<typename _Arg>
+	iterator
+	_M_insert_bucket(_Arg&&, size_type,
+			 typename _Hashtable::_Hash_code_type);
+
+      template<typename _Arg>
+	std::pair<iterator, bool>
+	_M_insert(_Arg&&, std::true_type);
+
+      template<typename _Arg>
+	iterator
+	_M_insert(_Arg&&, std::false_type);
+
+      typedef typename std::conditional<__unique_keys,
+					std::pair<iterator, bool>,
+					iterator>::type
+	_Insert_Return_Type;
+
+      typedef typename std::conditional<__unique_keys,
+					std::_Select1st<_Insert_Return_Type>,
+					std::_Identity<_Insert_Return_Type>
+				   >::type
+	_Insert_Conv_Type;
+
+    public:
+      // Insert and erase
+      _Insert_Return_Type
+      insert(const value_type& __v)
+      { return _M_insert(__v, std::integral_constant<bool, __unique_keys>()); }
+
+      iterator
+      insert(const_iterator, const value_type& __v)
+      { return _Insert_Conv_Type()(insert(__v)); }
+
+      _Insert_Return_Type
+      insert(value_type&& __v)
+      { return _M_insert(std::move(__v),
+			 std::integral_constant<bool, __unique_keys>()); }
+
+      iterator
+      insert(const_iterator, value_type&& __v)
+      { return _Insert_Conv_Type()(insert(std::move(__v))); }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<!__constant_iterators
+			      && std::is_convertible<_Pair,
+						     value_type>::value>::type>
+	_Insert_Return_Type
+	insert(_Pair&& __v)
+	{ return _M_insert(std::forward<_Pair>(__v),
+			   std::integral_constant<bool, __unique_keys>()); }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<!__constant_iterators
+			      && std::is_convertible<_Pair,
+						     value_type>::value>::type>
+	iterator
+	insert(const_iterator, _Pair&& __v)
+	{ return _Insert_Conv_Type()(insert(std::forward<_Pair>(__v))); }
+
+      template<typename _InputIterator>
+	void
+	insert(_InputIterator __first, _InputIterator __last);
+
+      void
+      insert(initializer_list<value_type> __l)
+      { this->insert(__l.begin(), __l.end()); }
+
+      iterator
+      erase(const_iterator);
+
+      // LWG 2059.
+      iterator
+      erase(iterator __it)
+      { return erase(const_iterator(__it)); }
+
+      size_type
+      erase(const key_type&);
+
+      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);
+
+      // DR 1189.
+      // reserve, if present, comes from _Rehash_base.
+
+    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>
+    template<typename... _Args>
+      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(_Args&&... __args)
+      {
+	_Node* __n = _M_node_allocator.allocate(1);
+	__try
+	  {
+	    _M_node_allocator.construct(__n, std::forward<_Args>(__args)...);
+	    __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)
+    {
+      _M_node_allocator.destroy(__n);
+      _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);
+      _M_begin_bucket_index = _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);
+	_M_begin_bucket_index = _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_begin_bucket_index(__ht._M_begin_bucket_index),
+      _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;
+	}
+    }
+
+  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_buckets(__ht._M_buckets),
+      _M_bucket_count(__ht._M_bucket_count),
+      _M_begin_bucket_index(__ht._M_begin_bucket_index),
+      _M_element_count(__ht._M_element_count),
+      _M_rehash_policy(__ht._M_rehash_policy)
+    {
+      __ht._M_rehash_policy = _RehashPolicy();
+      __ht._M_bucket_count = __ht._M_rehash_policy._M_next_bkt(0);
+      __ht._M_buckets = __ht._M_allocate_buckets(__ht._M_bucket_count);
+      __ht._M_begin_bucket_index = __ht._M_bucket_count;
+      __ht._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>
+    _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>::
+    swap(_Hashtable& __x)
+    {
+      // 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_begin_bucket_index, __x._M_begin_bucket_index);
+      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>
+    template<typename _Arg>
+      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(_Arg&& __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);
+
+	if (__do_rehash.first)
+	  {
+	    const key_type& __k = this->_M_extract(__v);
+	    __n = this->_M_bucket_index(__k, __code, __do_rehash.second);
+	  }
+
+	// 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(std::forward<_Arg>(__v));
+
+	__try
+	  {
+	    if (__do_rehash.first)
+	      _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;
+	    if (__n < _M_begin_bucket_index)
+	      _M_begin_bucket_index = __n;
+	    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>
+    template<typename _Arg>
+      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(_Arg&& __v, std::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(std::forward<_Arg>(__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>
+    template<typename _Arg>
+      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(_Arg&& __v, std::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(std::forward<_Arg>(__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;
+	    if (__n < _M_begin_bucket_index)
+	      _M_begin_bucket_index = __n;
+	  }
+	this->_M_store_code(__new_node, __code);
+
+	++_M_element_count;
+	return iterator(__new_node, _M_buckets + __n);
+      }
+
+  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(const_iterator __it)
+    {
+      iterator __result(__it._M_cur_node, __it._M_cur_bucket);
+      ++__result;
+
+      _Node* __cur = *__it._M_cur_bucket;
+      if (__cur == __it._M_cur_node)
+	{
+	  *__it._M_cur_bucket = __cur->_M_next;
+
+	  // If _M_begin_bucket_index no longer indexes the first non-empty
+	  // bucket - its single node is being erased - update it.
+	  if (!_M_buckets[_M_begin_bucket_index])
+	    _M_begin_bucket_index = __result._M_cur_bucket - _M_buckets;
+	}
+      else
+	{
+	  _Node* __next = __cur->_M_next;
+	  while (__next != __it._M_cur_node)
+	    {
+	      __cur = __next;
+	      __next = __cur->_M_next;
+	    }
+	  __cur->_M_next = __next->_M_next;
+	}
+
+      _M_deallocate_node(__it._M_cur_node);
+      --_M_element_count;
+
+      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 (std::__addressof(this->_M_extract((*__slot)->_M_v))
+	      != std::__addressof(__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;
+	}
+
+      // If the entire bucket indexed by _M_begin_bucket_index has been
+      // erased look forward for the first non-empty bucket.
+      if (!_M_buckets[_M_begin_bucket_index])
+	{
+	  if (!_M_element_count)
+	    _M_begin_bucket_index = _M_bucket_count;
+	  else
+	    {
+	      ++_M_begin_bucket_index;
+	      while (!_M_buckets[_M_begin_bucket_index])
+		++_M_begin_bucket_index;
+	    }
+	}
+
+      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(const_iterator __first, const_iterator __last)
+    {
+       while (__first != __last)
+	 __first = this->erase(__first);
+      return iterator(__last._M_cur_node, __last._M_cur_bucket);
+    }
+
+  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;
+      _M_begin_bucket_index = _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>::
+    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
+	{
+	  _M_begin_bucket_index = __n;
+	  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;
+		if (__new_index < _M_begin_bucket_index)
+		  _M_begin_bucket_index = __new_index;
+	      }
+	  _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;
+	  _M_begin_bucket_index = _M_bucket_count;
+	  __throw_exception_again;
+	}
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _HASHTABLE_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable_policy.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable_policy.h
new file mode 100644
index 0000000..f6e1876
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable_policy.h
@@ -0,0 +1,987 @@
+// Internal policy header for unordered_set and unordered_map -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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_policy.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly.
+ *  @headername{unordered_map,unordered_set}
+ */
+
+#ifndef _HASHTABLE_POLICY_H
+#define _HASHTABLE_POLICY_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __detail
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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());
+    }
+
+  // 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;
+
+      template<typename... _Args>
+	_Hash_node(_Args&&... __args)
+	: _M_v(std::forward<_Args>(__args)...),
+	  _M_hash_code(), _M_next() { }
+    };
+
+  template<typename _Value>
+    struct _Hash_node<_Value, false>
+    {
+      _Value       _M_v;
+      _Hash_node*  _M_next;
+
+      template<typename... _Args>
+	_Hash_node(_Args&&... __args)
+	: _M_v(std::forward<_Args>(__args)...),
+	  _M_next() { }
+    };
+
+  // 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 std::conditional<__constant_iterators,
+					const _Value*, _Value*>::type
+						       pointer;
+      typedef typename std::conditional<__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 std::__addressof(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 std::__addressof(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 std::conditional<__constant_iterators,
+					const _Value*, _Value*>::type
+						       pointer;
+      typedef typename std::conditional<__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 std::__addressof(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 std::__addressof(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 = std::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 = std::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 =
+	      std::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::_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);
+
+      mapped_type&
+      operator[](_Key&& __k);
+
+      // _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;
+    };
+
+  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;
+    }
+
+  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[](_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(std::move(__k),
+						    mapped_type()),
+				     __n, __code)->second;
+      return (__p->_M_v).second;
+    }
+
+  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;
+    }
+
+  // class template _Rehash_base.  Give hashtable the max_load_factor
+  // functions and reserve 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));
+      }
+
+      void
+      reserve(std::size_t __n)
+      {
+	_Hashtable* __this = static_cast<_Hashtable*>(this);
+	__this->rehash(__builtin_ceil(__n / max_load_factor()));
+      }
+    };
+
+  // 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;
+    };
+
+
+  // Class template _Equality_base.  This is for implementing equality
+  // comparison for unordered containers, per N3068, by John Lakos and
+  // Pablo Halpern.  Algorithmically, we follow closely the reference
+  // implementations therein.
+  template<typename _ExtractKey, bool __unique_keys,
+	   typename _Hashtable>
+    struct _Equality_base;
+
+  template<typename _ExtractKey, typename _Hashtable>
+    struct _Equality_base<_ExtractKey, true, _Hashtable>
+    {
+      bool _M_equal(const _Hashtable&) const;
+    };
+
+  template<typename _ExtractKey, typename _Hashtable>
+    bool
+    _Equality_base<_ExtractKey, true, _Hashtable>::
+    _M_equal(const _Hashtable& __other) const
+    {
+      const _Hashtable* __this = static_cast<const _Hashtable*>(this);
+
+      if (__this->size() != __other.size())
+	return false;
+
+      for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx)
+	{
+	  const auto __ity = __other.find(_ExtractKey()(*__itx));
+	  if (__ity == __other.end() || *__ity != *__itx)
+	    return false;
+	}
+      return true;
+    }
+
+  template<typename _ExtractKey, typename _Hashtable>
+    struct _Equality_base<_ExtractKey, false, _Hashtable>
+    {
+      bool _M_equal(const _Hashtable&) const;
+
+    private:
+      template<typename _Uiterator>
+	static bool
+	_S_is_permutation(_Uiterator, _Uiterator, _Uiterator);
+    };
+
+  // See std::is_permutation in N3068.
+  template<typename _ExtractKey, typename _Hashtable>
+    template<typename _Uiterator>
+      bool
+      _Equality_base<_ExtractKey, false, _Hashtable>::
+      _S_is_permutation(_Uiterator __first1, _Uiterator __last1,
+			_Uiterator __first2)
+      {
+	for (; __first1 != __last1; ++__first1, ++__first2)
+	  if (!(*__first1 == *__first2))
+	    break;
+
+	if (__first1 == __last1)
+	  return true;
+
+	_Uiterator __last2 = __first2;
+	std::advance(__last2, std::distance(__first1, __last1));
+
+	for (_Uiterator __it1 = __first1; __it1 != __last1; ++__it1)
+	  {
+	    _Uiterator __tmp =  __first1;
+	    while (__tmp != __it1 && !(*__tmp == *__it1))
+	      ++__tmp;
+
+	    // We've seen this one before.
+	    if (__tmp != __it1)
+	      continue;
+
+	    std::ptrdiff_t __n2 = 0;
+	    for (__tmp = __first2; __tmp != __last2; ++__tmp)
+	      if (*__tmp == *__it1)
+		++__n2;
+
+	    if (!__n2)
+	      return false;
+
+	    std::ptrdiff_t __n1 = 0;
+	    for (__tmp = __it1; __tmp != __last1; ++__tmp)
+	      if (*__tmp == *__it1)
+		++__n1;
+
+	    if (__n1 != __n2)
+	      return false;
+	  }
+	return true;
+      }
+
+  template<typename _ExtractKey, typename _Hashtable>
+    bool
+    _Equality_base<_ExtractKey, false, _Hashtable>::
+    _M_equal(const _Hashtable& __other) const
+    {
+      const _Hashtable* __this = static_cast<const _Hashtable*>(this);
+
+      if (__this->size() != __other.size())
+	return false;
+
+      for (auto __itx = __this->begin(); __itx != __this->end();)
+	{
+	  const auto __xrange = __this->equal_range(_ExtractKey()(*__itx));
+	  const auto __yrange = __other.equal_range(_ExtractKey()(*__itx));
+
+	  if (std::distance(__xrange.first, __xrange.second)
+	      != std::distance(__yrange.first, __yrange.second))
+	    return false;
+
+	  if (!_S_is_permutation(__xrange.first,
+				 __xrange.second,
+				 __yrange.first))
+	    return false;
+
+	  __itx = __xrange.second;
+	}
+      return true;
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __detail
+} // namespace std
+
+#endif // _HASHTABLE_POLICY_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/indirect_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/indirect_array.h
new file mode 100644
index 0000000..d7b7b08
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/indirect_array.h
@@ -0,0 +1,213 @@
+// The template and inlines for the -*- C++ -*- indirect_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2009, 2010
+//  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/indirect_array.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_VERSION
+} // namespace
+
+#endif /* _INDIRECT_ARRAY_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ios_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ios_base.h
new file mode 100644
index 0000000..8825657
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ios_base.h
@@ -0,0 +1,977 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ios_base.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+//
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 _GLIBCXX_CONSTEXPR _Ios_Fmtflags
+  operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+  { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
+  operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+  { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
+  operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+  { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
+  operator~(_Ios_Fmtflags __a)
+  { return _Ios_Fmtflags(~static_cast<int>(__a)); }
+
+  inline const _Ios_Fmtflags&
+  operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+  { return __a = __a | __b; }
+
+  inline const _Ios_Fmtflags&
+  operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+  { return __a = __a & __b; }
+
+  inline const _Ios_Fmtflags&
+  operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+  { return __a = __a ^ __b; }
+
+
+  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 _GLIBCXX_CONSTEXPR _Ios_Openmode
+  operator&(_Ios_Openmode __a, _Ios_Openmode __b)
+  { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Openmode
+  operator|(_Ios_Openmode __a, _Ios_Openmode __b)
+  { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Openmode
+  operator^(_Ios_Openmode __a, _Ios_Openmode __b)
+  { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Openmode
+  operator~(_Ios_Openmode __a)
+  { return _Ios_Openmode(~static_cast<int>(__a)); }
+
+  inline const _Ios_Openmode&
+  operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
+  { return __a = __a | __b; }
+
+  inline const _Ios_Openmode&
+  operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
+  { return __a = __a & __b; }
+
+  inline const _Ios_Openmode&
+  operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
+  { return __a = __a ^ __b; }
+
+
+  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 _GLIBCXX_CONSTEXPR _Ios_Iostate
+  operator&(_Ios_Iostate __a, _Ios_Iostate __b)
+  { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Iostate
+  operator|(_Ios_Iostate __a, _Ios_Iostate __b)
+  { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Iostate
+  operator^(_Ios_Iostate __a, _Ios_Iostate __b)
+  { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+  inline _GLIBCXX_CONSTEXPR _Ios_Iostate
+  operator~(_Ios_Iostate __a)
+  { return _Ios_Iostate(~static_cast<int>(__a)); }
+
+  inline const _Ios_Iostate&
+  operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
+  { return __a = __a | __b; }
+
+  inline const _Ios_Iostate&
+  operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
+  { return __a = __a & __b; }
+
+  inline const  _Ios_Iostate&
+  operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
+  { return __a = __a ^ __b; }
+
+
+  enum _Ios_Seekdir 
+    { 
+      _S_beg = 0,
+      _S_cur = _GLIBCXX_STDIO_SEEK_CUR,
+      _S_end = _GLIBCXX_STDIO_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 @a _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 @a _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 @a _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 @a _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:
+    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() 
+      {
+        // Be race-detector-friendly.  For more info see bits/c++config.
+        _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
+        int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1);
+        if (__res == 0)
+          {
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
+          }
+        return __res;
+      }
+    };
+
+     _Callback_list*	_M_callbacks;
+
+    void
+    _M_call_callbacks(event __ev) throw();
+
+    void
+    _M_dispose_callbacks(void) throw();
+
+    // 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() throw();
+
+  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 @a 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.
+     *
+     *  <em>Minimum field width</em> 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) throw();
+
+    /**
+     *  @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() throw ();
+
+  // _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_VERSION
+} // namespace
+
+#endif /* _IOS_BASE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/istream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/istream.tcc
new file mode 100644
index 0000000..9055c31
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/istream.tcc
@@ -0,0 +1,1094 @@
+// istream classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/istream.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{istream}
+ */
+
+//
+// ISO C++ 14882: 27.6.1  Input streams
+//
+
+#ifndef _ISTREAM_TCC
+#define _ISTREAM_TCC 1
+
+#pragma GCC system_header
+
+#include <bits/cxxabi_forced.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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::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::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.
+      sentry __cerb(*this, false);
+      if (__cerb)
+	{
+	  ios_base::iostate __err = ios_base::goodbit;
+	  __try
+	    {
+	      long __l;
+	      const __num_get_type& __ng = __check_facet(this->_M_num_get);
+	      __ng.get(*this, 0, *this, __err, __l);
+
+	      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+	      // 696. istream::operator>>(int&) broken.
+	      if (__l < __gnu_cxx::__numeric_traits<short>::__min)
+		{
+		  __err |= ios_base::failbit;
+		  __n = __gnu_cxx::__numeric_traits<short>::__min;
+		}
+	      else if (__l > __gnu_cxx::__numeric_traits<short>::__max)
+		{
+		  __err |= ios_base::failbit;
+		  __n = __gnu_cxx::__numeric_traits<short>::__max;
+		}
+	      else
+		__n = short(__l);
+	    }
+	  __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>>(int& __n)
+    {
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 118. basic_istream uses nonexistent num_get member functions.
+      sentry __cerb(*this, false);
+      if (__cerb)
+	{
+	  ios_base::iostate __err = ios_base::goodbit;
+	  __try
+	    {
+	      long __l;
+	      const __num_get_type& __ng = __check_facet(this->_M_num_get);
+	      __ng.get(*this, 0, *this, __err, __l);
+
+	      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+	      // 696. istream::operator>>(int&) broken.
+	      if (__l < __gnu_cxx::__numeric_traits<int>::__min)
+		{
+		  __err |= ios_base::failbit;
+		  __n = __gnu_cxx::__numeric_traits<int>::__min;
+		}
+	      else if (__l > __gnu_cxx::__numeric_traits<int>::__max)
+		{
+		  __err |= ios_base::failbit;	      
+		  __n = __gnu_cxx::__numeric_traits<int>::__max;
+		}
+	      else
+		__n = int(__l);
+	    }
+	  __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>>(__streambuf_type* __sbout)
+    {
+      ios_base::iostate __err = 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::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::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::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::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::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::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::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::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::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::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::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;
+      // Clear eofbit per N3168.
+      this->clear(this->rdstate() & ~ios_base::eofbit);
+      sentry __cerb(*this, true);
+      if (__cerb)
+	{
+	  ios_base::iostate __err = 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;
+      // Clear eofbit per N3168.
+      this->clear(this->rdstate() & ~ios_base::eofbit);
+      sentry __cerb(*this, true);
+      if (__cerb)
+	{
+	  ios_base::iostate __err = 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::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);
+      sentry __cerb(*this, true);
+      if (__cerb)
+	{
+	  __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.
+      // Clear eofbit per N3168.
+      this->clear(this->rdstate() & ~ios_base::eofbit);
+      sentry __cerb(*this, true);
+      if (__cerb)
+	{
+	  ios_base::iostate __err = 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.
+      // Clear eofbit per N3168.
+      this->clear(this->rdstate() & ~ios_base::eofbit);
+      sentry __cerb(*this, true);
+      if (__cerb)
+	{
+	  ios_base::iostate __err = 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::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::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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/list.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/list.tcc
new file mode 100644
index 0000000..01c1bc6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/list.tcc
@@ -0,0 +1,470 @@
+// List implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/list.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{list}
+ */
+
+#ifndef _LIST_TCC
+#define _LIST_TCC 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  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(std::__addressof(__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->_M_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->_M_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;
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp, typename _Alloc>
+    void
+    list<_Tp, _Alloc>::
+    _M_default_append(size_type __n)
+    {
+      size_type __i = 0;
+      __try
+	{
+	  for (; __i < __n; ++__i)
+	    emplace_back();
+	}
+      __catch(...)
+	{
+	  for (; __i; --__i)
+	    pop_back();
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    list<_Tp, _Alloc>::
+    resize(size_type __new_size)
+    {
+      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()
+	_M_default_append(__new_size - __len);
+    }
+
+  template<typename _Tp, typename _Alloc>
+    void
+    list<_Tp, _Alloc>::
+    resize(size_type __new_size, const 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);
+    }
+#else
+  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);
+    }
+#endif
+
+  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 (std::__addressof(*__first) != std::__addressof(__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_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _LIST_TCC */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.h
new file mode 100644
index 0000000..80ba735
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.h
@@ -0,0 +1,825 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/locale_classes.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 22.1.1 Class locale
+  /**
+   *  @brief  Container class for localization functionality.
+   *  @ingroup locales
+   *
+   *  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() throw();
+
+    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.
+   *  @ingroup locales
+   *
+   *  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) throw();
+
+    static void
+    _S_destroy_c_locale(__c_locale& __cloc);
+
+    static __c_locale
+    _S_lc_ctype_c_locale(__c_locale __cloc, const char* __s);
+
+    // Returns data from the underlying "C" library data for the
+    // classic locale.
+    static __c_locale
+    _S_get_c_locale();
+
+    _GLIBCXX_CONST static const char*
+    _S_get_c_name() throw();
+
+  private:
+    void
+    _M_add_reference() const throw()
+    { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
+
+    void
+    _M_remove_reference() const throw()
+    {
+      // Be race-detector-friendly.  For more info see bits/c++config.
+      _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
+      if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
+	{
+          _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
+	  __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.
+   *  @ingroup locales
+   *
+   *  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 throw();
+  };
+
+
+  // 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()
+    {
+      // Be race-detector-friendly.  For more info see bits/c++config.
+      _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
+      if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
+	{
+          _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
+	  __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 throw();
+
+      size_t
+      _M_transform(_CharT*, const _CharT*, size_t) const throw();
+
+  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 throw();
+
+  template<>
+    size_t
+    collate<char>::_M_transform(char*, const char*, size_t) const throw();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  template<>
+    int
+    collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const throw();
+
+  template<>
+    size_t
+    collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const throw();
+#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_VERSION
+} // namespace
+
+# include <bits/locale_classes.tcc>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.tcc
new file mode 100644
index 0000000..5b2901a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.tcc
@@ -0,0 +1,273 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/locale_classes.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+#ifndef _LOCALE_CLASSES_TCC
+#define _LOCALE_CLASSES_TCC 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 throw ()
+    { return 0; }
+
+  // Generic version does nothing.
+  template<typename _CharT>
+    size_t
+    collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const throw ()
+    { 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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.h
new file mode 100644
index 0000000..41732f3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.h
@@ -0,0 +1,2610 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/locale_facets.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 _Tp and store results.
+  // NB: This is specialized for all required types, there is no
+  // generic definition.
+  template<typename _Tp>
+    void
+    __convert_to_v(const char*, _Tp&, ios_base::iostate&,
+		   const __c_locale&) throw();
+
+  // Explicit specializations for required types.
+  template<>
+    void
+    __convert_to_v(const char*, float&, ios_base::iostate&,
+		   const __c_locale&) throw();
+
+  template<>
+    void
+    __convert_to_v(const char*, double&, ios_base::iostate&,
+		   const __c_locale&) throw();
+
+  template<>
+    void
+    __convert_to_v(const char*, long double&, ios_base::iostate&,
+		   const __c_locale&) throw();
+
+  // 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.
+
+  /**
+   *  @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;
+    };
+
+  /**
+   *  @brief  Primary class template ctype facet.
+   *  @ingroup locales
+   *
+   *  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;
+
+  /**
+   *  @brief  The ctype<char> specialization.
+   *  @ingroup locales
+   *
+   *  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
+  /**
+   *  @brief  The ctype<wchar_t> specialization.
+   *  @ingroup locales
+   *
+   *  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 throw();
+
+      /// 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() throw();
+    };
+#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_VERSION
+} // namespace
+
+// Include host and configuration specific ctype inlines.
+#include <bits/ctype_inline.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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) throw();
+  };
+
+  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(0), _M_grouping_size(0),
+	_M_use_grouping(false),
+	_M_truename(0), _M_truename_size(0), _M_falsename(0),
+	_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  Primary class template numpunct.
+   *  @ingroup locales
+   *
+   *  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(0)
+      { _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(0)
+      { _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 = 0);
+    };
+
+  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_NAMESPACE_LDBL
+
+  /**
+   *  @brief  Primary class template num_get.
+   *  @ingroup locales
+   *
+   *  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  Primary class template num_put.
+   *  @ingroup locales
+   *
+   *  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_NAMESPACE_LDBL
+
+  // 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_VERSION
+} // namespace
+
+# include <bits/locale_facets.tcc>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.tcc
new file mode 100644
index 0000000..80bda15
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.tcc
@@ -0,0 +1,1362 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/locale_facets.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+#ifndef _LOCALE_FACETS_TCC
+#define _LOCALE_FACETS_TCC 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 = 0;
+	    __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);
+
+      char* __grouping = 0;
+      _CharT* __truename = 0;
+      _CharT* __falsename = 0;
+      __try
+	{
+	  _M_grouping_size = __np.grouping().size();
+	  __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();
+	  __truename = new _CharT[_M_truename_size];
+	  __np.truename().copy(__truename, _M_truename_size);
+	  _M_truename = __truename;
+
+	  _M_falsename_size = __np.falsename().size();
+	  __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);
+	}
+      __catch(...)
+	{
+	  delete [] __grouping;
+	  delete [] __truename;
+	  delete [] __falsename;
+	  __throw_exception_again;
+	}
+    }
+
+  // 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"
+  _GLIBCXX_PURE bool
+  __verify_grouping(const char* __grouping, size_t __grouping_size,
+		    const string& __grouping_tmp) throw ();
+
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
+
+  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;
+	    __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>::__is_signed)
+	  ? -__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
+		&& __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
+	      __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_NAMESPACE_LDBL
+
+  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_NAMESPACE_LDBL
+
+  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_NAMESPACE_LDBL
+
+  // 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.
+#if _GLIBCXX_EXTERN_TEMPLATE
+  extern template class numpunct<char>;
+  extern template class numpunct_byname<char>;
+  extern template class _GLIBCXX_NAMESPACE_LDBL num_get<char>;
+  extern template class _GLIBCXX_NAMESPACE_LDBL 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_NAMESPACE_LDBL num_get<wchar_t>;
+  extern template class _GLIBCXX_NAMESPACE_LDBL 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.h
new file mode 100644
index 0000000..be7c1a4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.h
@@ -0,0 +1,1938 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/locale_facets_nonio.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief  Time format ordering data.
+   *  @ingroup locales
+   *
+   *  This class provides an enum representing different orderings of
+   *  time: 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(0), _M_date_era_format(0), _M_time_format(0),
+      _M_time_era_format(0), _M_date_time_format(0),
+      _M_date_time_era_format(0), _M_am(0), _M_pm(0),
+      _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0),
+      _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0),
+      _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0),
+      _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0),
+      _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0),
+      _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0),
+      _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0),
+      _M_amonth02(0), _M_amonth03(0), _M_amonth04(0),
+      _M_amonth05(0), _M_amonth06(0), _M_amonth07(0),
+      _M_amonth08(0), _M_amonth09(0), _M_amonth10(0),
+      _M_amonth11(0), _M_amonth12(0), _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 throw ();
+
+      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 = 0);
+    };
+
+  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 throw ();
+
+#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 throw ();
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+  // Include host and configuration specific timepunct functions.
+  #include <bits/time_members.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief  Primary class template time_get.
+   *  @ingroup locales
+   *
+   *  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 @a x given to time_put::put() only
+       *  uses month, day, and year.  If the format @a 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 @a 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 @a 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 @a 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 @a 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 @a 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 @a 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 @a 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 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 day or month name in a const _CharT* array.
+      iter_type
+      _M_extract_wday_or_month(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  Primary class template time_put.
+   *  @ingroup locales
+   *
+   *  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.
+   *  @ingroup locales
+   *
+   *  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
+    _GLIBCXX_CONST static pattern
+    _S_construct_pattern(char __precedes, char __space, char __posn) throw ();
+  };
+
+  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(0), _M_grouping_size(0), _M_use_grouping(false),
+      _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()),
+      _M_curr_symbol(0), _M_curr_symbol_size(0),
+      _M_positive_sign(0), _M_positive_sign_size(0),
+      _M_negative_sign(0), _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  Primary class template moneypunct.
+   *  @ingroup locales
+   *
+   *  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(0)
+      { _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(0)
+      { _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 <code>\003\002</code>
+       *  and is applied to the number 123456789, this corresponds to
+       *  12,34,56,789.  Note that if the string was <code>32</code>, 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() == &apos;$&apos;
+       *  positive_sign() == &apos;+&apos;, and value 10.01, and
+       *  options set to force the symbol, the corresponding string is
+       *  <code>$+10.01</code>.
+       *
+       *  @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 = 0,
+				const char* __name = 0);
+    };
+
+  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_NAMESPACE_LDBL
+
+  /**
+   *  @brief  Primary class template money_get.
+   *  @ingroup locales
+   *
+   *  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 <code>1001</code> 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  Primary class template money_put.
+   *  @ingroup locales
+   *
+   *  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 <code>$10.01</code> 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 <code>1001</code> in a US locale
+       *  would write <code>$10.01</code> 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 <code>$10.01</code> 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 <code>1001</code> in a US locale
+       *  would write <code>$10.01</code> 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_NAMESPACE_LDBL
+
+  /**
+   *  @brief  Messages facet base class providing catalog typedef.
+   *  @ingroup locales
+   */
+  struct messages_base
+  {
+    typedef int catalog;
+  };
+
+  /**
+   *  @brief  Primary class template messages.
+   *  @ingroup locales
+   *
+   *  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_VERSION
+} // namespace
+
+// Include host and configuration specific messages functions.
+#include <bits/messages_members.h>
+
+// 22.2.1.5  Template class codecvt
+#include <bits/codecvt.h>
+
+#include <bits/locale_facets_nonio.tcc>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.tcc
new file mode 100644
index 0000000..fbf7005
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.tcc
@@ -0,0 +1,1373 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/locale_facets_nonio.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+#ifndef _LOCALE_FACETS_NONIO_TCC
+#define _LOCALE_FACETS_NONIO_TCC 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 = 0;
+	    __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_decimal_point = __mp.decimal_point();
+      _M_thousands_sep = __mp.thousands_sep();
+      _M_frac_digits = __mp.frac_digits();
+
+      char* __grouping = 0;
+      _CharT* __curr_symbol = 0;
+      _CharT* __positive_sign = 0;
+      _CharT* __negative_sign = 0;     
+      __try
+	{
+	  _M_grouping_size = __mp.grouping().size();
+	  __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_curr_symbol_size = __mp.curr_symbol().size();
+	  __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();
+	  __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();
+	  __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);
+	}
+      __catch(...)
+	{
+	  delete [] __grouping;
+	  delete [] __curr_symbol;
+	  delete [] __positive_sign;
+	  delete [] __negative_sign;
+	  __throw_exception_again;
+	}
+    }
+
+_GLIBCXX_BEGIN_NAMESPACE_LDBL
+
+  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_NAMESPACE_LDBL
+
+  // 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;
+      size_t __i = 0;
+      for (; __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.
+		case 'Y':
+		  // Year [1900).
+		  // NB: We parse either two digits, implicitly years since
+		  // 1900, or 4 digits, full year.  In both cases we can 
+		  // reconstruct [tm_year].  See also libstdc++/26701.
+		  __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
+					 __io, __tmperr);
+		  if (!__tmperr)
+		    __tm->tm_year = __mem < 0 ? __mem + 100 : __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 || __i != __len)
+	__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;
+      // Special encoding for do_get_year, 'y', and 'Y' above.
+      else if (__len == 4 && __i == 2)
+	__member = __value - 100;
+      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>::
+    _M_extract_wday_or_month(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(2 * sizeof(int)
+							  * __indexlen));
+      size_t __nmatches = 0;
+      size_t* __matches_lengths = 0;
+      size_t __pos = 0;
+
+      if (__beg != __end)
+	{
+	  const char_type __c = *__beg;
+	  for (size_t __i = 0; __i < 2 * __indexlen; ++__i)
+	    if (__c == __names[__i][0]
+		|| __c == __ctype.toupper(__names[__i][0]))
+	      __matches[__nmatches++] = __i;
+	}
+
+      if (__nmatches)
+	{
+	  ++__beg, ++__pos;
+
+	  __matches_lengths
+	    = static_cast<size_t*>(__builtin_alloca(sizeof(size_t)
+						    * __nmatches));
+	  for (size_t __i = 0; __i < __nmatches; ++__i)
+	    __matches_lengths[__i]
+	      = __traits_type::length(__names[__matches[__i]]);
+	}
+
+      for (; __beg != __end; ++__beg, ++__pos)
+	{
+	  size_t __nskipped = 0;
+	  const char_type __c = *__beg;
+	  for (size_t __i = 0; __i < __nmatches;)
+	    {
+	      const char_type* __name = __names[__matches[__i]];
+	      if (__pos >= __matches_lengths[__i])
+		++__nskipped, ++__i;
+	      else if (!(__name[__pos] == __c))
+		{
+		  --__nmatches;
+		  __matches[__i] = __matches[__nmatches];
+		  __matches_lengths[__i] = __matches_lengths[__nmatches];
+		}
+	      else
+		++__i;
+	    }
+	  if (__nskipped == __nmatches)
+	    break;
+	}
+
+      if ((__nmatches == 1 && __matches_lengths[0] == __pos)
+	  || (__nmatches == 2 && (__matches_lengths[0] == __pos
+				  || __matches_lengths[1] == __pos)))
+	__member = (__matches[0] >= __indexlen
+		    ? __matches[0] - __indexlen : __matches[0]);
+      else
+	__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[14];
+      __tp._M_days_abbreviated(__days);
+      __tp._M_days(__days + 7);
+      int __tmpwday;
+      ios_base::iostate __tmperr = ios_base::goodbit;
+
+      __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7,
+				       __io, __tmperr);
+      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[24];
+      __tp._M_months_abbreviated(__months);
+      __tp._M_months(__months + 12);
+      int __tmpmon;
+      ios_base::iostate __tmperr = ios_base::goodbit;
+
+      __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12,
+				       __io, __tmperr);
+      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);
+      int __tmpyear;
+      ios_base::iostate __tmperr = ios_base::goodbit;
+
+      __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 9999, 4,
+			     __io, __tmperr);
+      if (!__tmperr)
+	__tm->tm_year = __tmpyear < 0 ? __tmpyear + 100 : __tmpyear - 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[__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.
+#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_NAMESPACE_LDBL money_get<char>;
+  extern template class _GLIBCXX_NAMESPACE_LDBL 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_NAMESPACE_LDBL money_get<wchar_t>;
+  extern template class _GLIBCXX_NAMESPACE_LDBL 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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/localefwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/localefwd.h
new file mode 100644
index 0000000..38e7dd3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/localefwd.h
@@ -0,0 +1,192 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/localefwd.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /** 
+   *  @defgroup locales Locales
+   *
+   *  Classes and functions for internationalization and localization.
+   */
+
+  // 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_NAMESPACE_LDBL
+  template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+    class num_get;
+  template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+    class num_put;
+_GLIBCXX_END_NAMESPACE_LDBL
+  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_NAMESPACE_LDBL
+  template<typename _CharT, typename _InIter =  istreambuf_iterator<_CharT> >
+    class money_get;
+  template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+    class money_put;
+_GLIBCXX_END_NAMESPACE_LDBL
+  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/mask_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/mask_array.h
new file mode 100644
index 0000000..8b652a8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/mask_array.h
@@ -0,0 +1,209 @@
+// The template and inlines for the -*- C++ -*- mask_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2009, 2010
+//  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/mask_array.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_VERSION
+} // namespace
+
+#endif /* _MASK_ARRAY_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/move.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/move.h
new file mode 100644
index 0000000..f591899
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/move.h
@@ -0,0 +1,145 @@
+// Move, forward and identity for C++0x + swap -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/move.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{utility}
+ */
+
+#ifndef _MOVE_H
+#define _MOVE_H 1
+
+#include <bits/c++config.h>
+#include <bits/concept_check.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Used, in C++03 mode too, by allocators, etc.
+  template<typename _Tp>
+    inline _Tp*
+    __addressof(_Tp& __r)
+    {
+      return reinterpret_cast<_Tp*>
+	(&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <type_traits> // Brings in std::declval too.
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+  
+  /// forward (as per N3143)
+  template<typename _Tp>
+    inline _Tp&&
+    forward(typename std::remove_reference<_Tp>::type& __t) 
+    { return static_cast<_Tp&&>(__t); }
+
+  template<typename _Tp>
+    inline _Tp&&
+    forward(typename std::remove_reference<_Tp>::type&& __t) 
+    {
+      static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument"
+		    " substituting _Tp is an lvalue reference type");
+      return static_cast<_Tp&&>(__t);
+    }
+
+  /**
+   *  @brief Move a value.
+   *  @ingroup mutating_algorithms
+   *  @param  __t  A thing of arbitrary type.
+   *  @return Same, moved.
+  */
+  template<typename _Tp>
+    inline typename std::remove_reference<_Tp>::type&&
+    move(_Tp&& __t)
+    { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
+
+  /// declval, from type_traits.
+
+  /**
+   *  @brief Returns the actual address of the object or function
+   *         referenced by r, even in the presence of an overloaded
+   *         operator&.
+   *  @param  __r  Reference to an object or function.
+   *  @return   The actual address.
+  */
+  template<typename _Tp>
+    inline _Tp*
+    addressof(_Tp& __r)
+    { return std::__addressof(__r); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#define _GLIBCXX_MOVE(__val) std::move(__val)
+#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
+#else
+#define _GLIBCXX_MOVE(__val) (__val)
+#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief Swaps two values.
+   *  @ingroup mutating_algorithms
+   *  @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_VERSION
+} // namespace
+
+#endif /* _MOVE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/nested_exception.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/nested_exception.h
new file mode 100644
index 0000000..d4804bb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/nested_exception.h
@@ -0,0 +1,166 @@
+// Nested Exception support header (nested_exception class) for -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/nested_exception.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{exception}
+ */
+
+#ifndef _GLIBCXX_NESTED_EXCEPTION_H
+#define _GLIBCXX_NESTED_EXCEPTION_H 1
+
+#pragma GCC visibility push(default)
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+
+#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+#  error This platform does not support exception propagation.
+#endif
+
+extern "C++" {
+
+namespace std
+{
+  /**
+   * @addtogroup exceptions
+   * @{
+   */
+
+  /// Exception class with exception_ptr data member.
+  class nested_exception
+  {
+    exception_ptr _M_ptr;
+
+  public:
+    nested_exception() throw() : _M_ptr(current_exception()) { }
+
+    nested_exception(const nested_exception&) = default;
+
+    nested_exception& operator=(const nested_exception&) = default;
+
+    virtual ~nested_exception();
+
+    void
+    rethrow_nested() const __attribute__ ((__noreturn__))
+    { rethrow_exception(_M_ptr); }
+
+    exception_ptr
+    nested_ptr() const
+    { return _M_ptr; }
+  };
+
+  template<typename _Except>
+    struct _Nested_exception : public _Except, public nested_exception
+    {
+      explicit _Nested_exception(_Except&& __ex)
+      : _Except(static_cast<_Except&&>(__ex))
+      { }
+    };
+
+  template<typename _Ex>
+    struct __get_nested_helper
+    {
+      static const nested_exception*
+      _S_get(const _Ex& __ex)
+      { return dynamic_cast<const nested_exception*>(&__ex); }
+    };
+
+  template<typename _Ex>
+    struct __get_nested_helper<_Ex*>
+    {
+      static const nested_exception*
+      _S_get(const _Ex* __ex)
+      { return dynamic_cast<const nested_exception*>(__ex); }
+    };
+
+  template<typename _Ex>
+    inline const nested_exception*
+    __get_nested_exception(const _Ex& __ex)
+    { return __get_nested_helper<_Ex>::_S_get(__ex); }
+
+  template<typename _Ex>
+    void
+    __throw_with_nested(_Ex&&, const nested_exception* = 0)
+    __attribute__ ((__noreturn__));
+
+  template<typename _Ex>
+    void
+    __throw_with_nested(_Ex&&, ...) __attribute__ ((__noreturn__));
+
+  // This function should never be called, but is needed to avoid a warning
+  // about ambiguous base classes when instantiating throw_with_nested<_Ex>()
+  // with a type that has an accessible nested_exception base.
+  template<typename _Ex>
+    inline void
+    __throw_with_nested(_Ex&& __ex, const nested_exception*)
+    { throw __ex; }
+
+  template<typename _Ex>
+    inline void
+    __throw_with_nested(_Ex&& __ex, ...)
+    { throw _Nested_exception<_Ex>(static_cast<_Ex&&>(__ex)); }
+  
+  template<typename _Ex>
+    void
+    throw_with_nested(_Ex __ex) __attribute__ ((__noreturn__));
+
+  /// If @p __ex is derived from nested_exception, @p __ex. 
+  /// Else, an implementation-defined object derived from both.
+  template<typename _Ex>
+    inline void
+    throw_with_nested(_Ex __ex)
+    {
+      if (__get_nested_exception(__ex))
+        throw __ex;
+      __throw_with_nested(static_cast<_Ex&&>(__ex), &__ex);
+    }
+
+  /// If @p __ex is derived from nested_exception, @p __ex.rethrow_nested().
+  template<typename _Ex>
+    inline void
+    rethrow_if_nested(const _Ex& __ex)
+    {
+      if (const nested_exception* __nested = __get_nested_exception(__ex))
+        __nested->rethrow_nested();
+    }
+
+  /// Overload, See N2619
+  inline void
+  rethrow_if_nested(const nested_exception& __ex)
+  { __ex.rethrow_nested(); }
+
+  // @} group exceptions
+} // namespace std
+
+} // extern "C++"
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#pragma GCC visibility pop
+
+#endif // _GLIBCXX_NESTED_EXCEPTION_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream.tcc
new file mode 100644
index 0000000..c0dce6a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream.tcc
@@ -0,0 +1,409 @@
+// ostream classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ostream.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ostream}
+ */
+
+//
+// ISO C++ 14882: 27.6.2  Output streams
+//
+
+#ifndef _OSTREAM_TCC
+#define _OSTREAM_TCC 1
+
+#pragma GCC system_header
+
+#include <bits/cxxabi_forced.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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::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::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::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::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::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::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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream_insert.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream_insert.h
new file mode 100644
index 0000000..f422865
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream_insert.h
@@ -0,0 +1,129 @@
+// Helpers for ostream inserters -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ostream_insert.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ostream}
+ */
+
+#ifndef _OSTREAM_INSERT_H
+#define _OSTREAM_INSERT_H 1
+
+#pragma GCC system_header
+
+#include <iosfwd>
+#include <bits/cxxabi_forced.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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.
+#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_VERSION
+} // namespace std
+
+#endif /* _OSTREAM_INSERT_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/postypes.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/postypes.h
new file mode 100644
index 0000000..69235d9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/postypes.h
@@ -0,0 +1,244 @@
+// Position types -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/postypes.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+//
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.h
new file mode 100644
index 0000000..988ee61
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.h
@@ -0,0 +1,5395 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/random.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{random}
+ */
+
+#ifndef _RANDOM_H
+#define _RANDOM_H 1
+
+#include <vector>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [26.4] Random number generation
+
+  /**
+   * @defgroup random Random Number Generation
+   * @ingroup numerics
+   *
+   * A facility for generating random numbers on selected distributions.
+   * @{
+   */
+
+  /**
+   * @brief A function template for converting the output of a (integral)
+   * uniform random number generator to a floatng point result in the range
+   * [0-1).
+   */
+  template<typename _RealType, size_t __bits,
+	   typename _UniformRandomNumberGenerator>
+    _RealType
+    generate_canonical(_UniformRandomNumberGenerator& __g);
+
+_GLIBCXX_END_NAMESPACE_VERSION
+
+  /*
+   * Implementation-space details.
+   */
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    template<typename _UIntType, size_t __w,
+	     bool = __w < static_cast<size_t>
+			  (std::numeric_limits<_UIntType>::digits)>
+      struct _Shift
+      { static const _UIntType __value = 0; };
+
+    template<typename _UIntType, size_t __w>
+      struct _Shift<_UIntType, __w, true>
+      { static const _UIntType __value = _UIntType(1) << __w; };
+
+    template<typename _Tp, _Tp __m, _Tp __a, _Tp __c, bool>
+      struct _Mod;
+
+    // Dispatch based on modulus value to prevent divide-by-zero compile-time
+    // errors when m == 0.
+    template<typename _Tp, _Tp __m, _Tp __a = 1, _Tp __c = 0>
+      inline _Tp
+      __mod(_Tp __x)
+      { return _Mod<_Tp, __m, __a, __c, __m == 0>::__calc(__x); }
+
+    /*
+     * An adaptor class for converting the output of any Generator into
+     * the input for a specific Distribution.
+     */
+    template<typename _Engine, typename _DInputType>
+      struct _Adaptor
+      {
+
+      public:
+	_Adaptor(_Engine& __g)
+	: _M_g(__g) { }
+
+	_DInputType
+	min() const
+	{ return _DInputType(0); }
+
+	_DInputType
+	max() const
+	{ return _DInputType(1); }
+
+	/*
+	 * Converts a value generated by the adapted random number generator
+	 * into a value in the input domain for the dependent random number
+	 * distribution.
+	 */
+	_DInputType
+	operator()()
+	{
+	  return std::generate_canonical<_DInputType,
+	                            std::numeric_limits<_DInputType>::digits,
+	                            _Engine>(_M_g);
+	}
+
+      private:
+	_Engine& _M_g;
+      };
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace __detail
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup random_generators Random Number Generators
+   * @ingroup 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 via
+   * 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<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    class linear_congruential_engine
+    {
+      static_assert(std::is_unsigned<_UIntType>::value, "template argument "
+		    "substituting _UIntType not an unsigned integral type");
+      static_assert(__m == 0u || (__a < __m && __c < __m),
+		    "template argument substituting __m out of bounds");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      /** The multiplier. */
+      static constexpr result_type multiplier   = __a;
+      /** An increment. */
+      static constexpr result_type increment    = __c;
+      /** The modulus. */
+      static constexpr result_type modulus      = __m;
+      static constexpr result_type default_seed = 1u;
+
+      /**
+       * @brief Constructs a %linear_congruential_engine random number
+       *        generator engine with seed @p __s.  The default seed value
+       *        is 1.
+       *
+       * @param __s The initial seed value.
+       */
+      explicit
+      linear_congruential_engine(result_type __s = default_seed)
+      { seed(__s); }
+
+      /**
+       * @brief Constructs a %linear_congruential_engine random number
+       *        generator engine seeded from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      template<typename _Sseq, typename = typename
+	std::enable_if<!std::is_same<_Sseq, linear_congruential_engine>::value>
+	       ::type>
+        explicit
+        linear_congruential_engine(_Sseq& __q)
+        { seed(__q); }
+
+      /**
+       * @brief Reseeds the %linear_congruential_engine random number generator
+       *        engine sequence to the seed @p __s.
+       *
+       * @param __s The new seed.
+       */
+      void
+      seed(result_type __s = default_seed);
+
+      /**
+       * @brief Reseeds the %linear_congruential_engine random number generator
+       *        engine
+       * sequence using values from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      template<typename _Sseq>
+        typename std::enable_if<std::is_class<_Sseq>::value>::type
+        seed(_Sseq& __q);
+
+      /**
+       * @brief 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.
+       */
+      static constexpr result_type
+      min()
+      { return __c == 0u ? 1u : 0u; }
+
+      /**
+       * @brief Gets the largest possible value in the output range.
+       */
+      static constexpr result_type
+      max()
+      { return __m - 1u; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+	for (; __z != 0ULL; --__z)
+	  (*this)();
+      }
+
+      /**
+       * @brief Gets the next random number in the sequence.
+       */
+      result_type
+      operator()()
+      {
+	_M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x);
+	return _M_x;
+      }
+
+      /**
+       * @brief 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
+       *              object.
+       *
+       * @returns true if the infinite sequences of generated values
+       *          would be equal, false otherwise.
+       */
+      friend bool
+      operator==(const linear_congruential_engine& __lhs,
+		 const linear_congruential_engine& __rhs)
+      { return __lhs._M_x == __rhs._M_x; }
+
+      /**
+       * @brief Writes the textual representation of the state x(i) of x to
+       *        @p __os.
+       *
+       * @param __os  The output stream.
+       * @param __lcr A % linear_congruential_engine random number generator.
+       * @returns __os.
+       */
+      template<typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+	       _UIntType1 __m1, typename _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::linear_congruential_engine<_UIntType1,
+		   __a1, __c1, __m1>&);
+
+      /**
+       * @brief 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_engine random number generator.
+       * @returns __is.
+       */
+      template<typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+	       _UIntType1 __m1, typename _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::linear_congruential_engine<_UIntType1, __a1,
+		   __c1, __m1>&);
+
+    private:
+      _UIntType _M_x;
+    };
+
+  /**
+   * @brief 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
+   *              object.
+   *
+   * @returns true if the infinite sequences of generated values
+   *          would be different, false otherwise.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    inline bool
+    operator!=(const std::linear_congruential_engine<_UIntType, __a,
+	       __c, __m>& __lhs,
+	       const std::linear_congruential_engine<_UIntType, __a,
+	       __c, __m>& __rhs)
+    { return !(__lhs == __rhs); }
+
+
+  /**
+   * 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<typename _UIntType, size_t __w,
+	   size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t,
+	   _UIntType __c, size_t __l, _UIntType __f>
+    class mersenne_twister_engine
+    {
+      static_assert(std::is_unsigned<_UIntType>::value, "template argument "
+		    "substituting _UIntType not an unsigned integral type");
+      static_assert(1u <= __m && __m <= __n,
+		    "template argument substituting __m out of bounds");
+      static_assert(__r <= __w, "template argument substituting "
+		    "__r out of bound");
+      static_assert(__u <= __w, "template argument substituting "
+		    "__u out of bound");
+      static_assert(__s <= __w, "template argument substituting "
+		    "__s out of bound");
+      static_assert(__t <= __w, "template argument substituting "
+		    "__t out of bound");
+      static_assert(__l <= __w, "template argument substituting "
+		    "__l out of bound");
+      static_assert(__w <= std::numeric_limits<_UIntType>::digits,
+		    "template argument substituting __w out of bound");
+      static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1),
+		    "template argument substituting __a out of bound");
+      static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1),
+		    "template argument substituting __b out of bound");
+      static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1),
+		    "template argument substituting __c out of bound");
+      static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1),
+		    "template argument substituting __d out of bound");
+      static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1),
+		    "template argument substituting __f out of bound");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      // parameter values
+      static constexpr size_t      word_size                 = __w;
+      static constexpr size_t      state_size                = __n;
+      static constexpr size_t      shift_size                = __m;
+      static constexpr size_t      mask_bits                 = __r;
+      static constexpr result_type xor_mask                  = __a;
+      static constexpr size_t      tempering_u               = __u;
+      static constexpr result_type tempering_d               = __d;
+      static constexpr size_t      tempering_s               = __s;
+      static constexpr result_type tempering_b               = __b;
+      static constexpr size_t      tempering_t               = __t;
+      static constexpr result_type tempering_c               = __c;
+      static constexpr size_t      tempering_l               = __l;
+      static constexpr result_type initialization_multiplier = __f;
+      static constexpr result_type default_seed = 5489u;
+
+      // constructors and member function
+      explicit
+      mersenne_twister_engine(result_type __sd = default_seed)
+      { seed(__sd); }
+
+      /**
+       * @brief Constructs a %mersenne_twister_engine random number generator
+       *        engine seeded from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      template<typename _Sseq, typename = typename
+        std::enable_if<!std::is_same<_Sseq, mersenne_twister_engine>::value>
+	       ::type>
+        explicit
+        mersenne_twister_engine(_Sseq& __q)
+        { seed(__q); }
+
+      void
+      seed(result_type __sd = default_seed);
+
+      template<typename _Sseq>
+	typename std::enable_if<std::is_class<_Sseq>::value>::type
+        seed(_Sseq& __q);
+
+      /**
+       * @brief Gets the smallest possible value in the output range.
+       */
+      static constexpr result_type
+      min()
+      { return 0; };
+
+      /**
+       * @brief Gets the largest possible value in the output range.
+       */
+      static constexpr result_type
+      max()
+      { return __detail::_Shift<_UIntType, __w>::__value - 1; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+	for (; __z != 0ULL; --__z)
+	  (*this)();
+      }
+
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two % mersenne_twister_engine random number generator
+       *        objects of the same type for equality.
+       *
+       * @param __lhs A % mersenne_twister_engine random number generator
+       *              object.
+       * @param __rhs Another % mersenne_twister_engine random number
+       *              generator object.
+       *
+       * @returns true if the infinite sequences of generated values
+       *          would be equal, false otherwise.
+       */
+      friend bool
+      operator==(const mersenne_twister_engine& __lhs,
+		 const mersenne_twister_engine& __rhs)
+      { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
+
+      /**
+       * @brief Inserts the current state of a % mersenne_twister_engine
+       *        random number generator engine @p __x into the output stream
+       *        @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A % mersenne_twister_engine random number generator
+       *             engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _UIntType1,
+	       size_t __w1, size_t __n1,
+	       size_t __m1, size_t __r1,
+	       _UIntType1 __a1, size_t __u1,
+	       _UIntType1 __d1, size_t __s1,
+	       _UIntType1 __b1, size_t __t1,
+	       _UIntType1 __c1, size_t __l1, _UIntType1 __f1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::mersenne_twister_engine<_UIntType1, __w1, __n1,
+		   __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
+		   __l1, __f1>&);
+
+      /**
+       * @brief Extracts the current state of a % mersenne_twister_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A % mersenne_twister_engine random number generator
+       *             engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _UIntType1,
+	       size_t __w1, size_t __n1,
+	       size_t __m1, size_t __r1,
+	       _UIntType1 __a1, size_t __u1,
+	       _UIntType1 __d1, size_t __s1,
+	       _UIntType1 __b1, size_t __t1,
+	       _UIntType1 __c1, size_t __l1, _UIntType1 __f1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::mersenne_twister_engine<_UIntType1, __w1, __n1, __m1,
+		   __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
+		   __l1, __f1>&);
+
+    private:
+      _UIntType _M_x[state_size];
+      size_t    _M_p;
+    };
+
+  /**
+   * @brief Compares two % mersenne_twister_engine random number generator
+   *        objects of the same type for inequality.
+   *
+   * @param __lhs A % mersenne_twister_engine random number generator
+   *              object.
+   * @param __rhs Another % mersenne_twister_engine random number
+   *              generator object.
+   *
+   * @returns true if the infinite sequences of generated values
+   *          would be different, false otherwise.
+   */
+  template<typename _UIntType, size_t __w,
+	   size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t,
+	   _UIntType __c, size_t __l, _UIntType __f>
+    inline bool
+    operator!=(const std::mersenne_twister_engine<_UIntType, __w, __n, __m,
+	       __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs,
+	       const std::mersenne_twister_engine<_UIntType, __w, __n, __m,
+	       __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs)
+    { return !(__lhs == __rhs); }
+
+
+  /**
+   * @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$.
+   *
+   * @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 _UIntType, size_t __w, size_t __s, size_t __r>
+    class subtract_with_carry_engine
+    {
+      static_assert(std::is_unsigned<_UIntType>::value, "template argument "
+		    "substituting _UIntType not an unsigned integral type");
+      static_assert(0u < __s && __s < __r,
+		    "template argument substituting __s out of bounds");
+      static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
+		    "template argument substituting __w out of bounds");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      // parameter values
+      static constexpr size_t      word_size    = __w;
+      static constexpr size_t      short_lag    = __s;
+      static constexpr size_t      long_lag     = __r;
+      static constexpr result_type default_seed = 19780503u;
+
+      /**
+       * @brief Constructs an explicitly seeded % subtract_with_carry_engine
+       *        random number generator.
+       */
+      explicit
+      subtract_with_carry_engine(result_type __sd = default_seed)
+      { seed(__sd); }
+
+      /**
+       * @brief Constructs a %subtract_with_carry_engine random number engine
+       *        seeded from the seed sequence @p __q.
+       *
+       * @param __q the seed sequence.
+       */
+      template<typename _Sseq, typename = typename
+        std::enable_if<!std::is_same<_Sseq, subtract_with_carry_engine>::value>
+	       ::type>
+        explicit
+        subtract_with_carry_engine(_Sseq& __q)
+        { seed(__q); }
+
+      /**
+       * @brief 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(result_type __sd = default_seed);
+
+      /**
+       * @brief Seeds the initial state @f$x_0@f$ of the
+       * % subtract_with_carry_engine random number generator.
+       */
+      template<typename _Sseq>
+	typename std::enable_if<std::is_class<_Sseq>::value>::type
+        seed(_Sseq& __q);
+
+      /**
+       * @brief Gets the inclusive minimum value of the range of random
+       * integers returned by this generator.
+       */
+      static constexpr result_type
+      min()
+      { return 0; }
+
+      /**
+       * @brief Gets the inclusive maximum value of the range of random
+       * integers returned by this generator.
+       */
+      static constexpr result_type
+      max()
+      { return __detail::_Shift<_UIntType, __w>::__value - 1; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+	for (; __z != 0ULL; --__z)
+	  (*this)();
+      }
+
+      /**
+       * @brief Gets the next random number in the sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two % subtract_with_carry_engine random number
+       *        generator objects of the same type for equality.
+       *
+       * @param __lhs A % subtract_with_carry_engine random number generator
+       *              object.
+       * @param __rhs Another % subtract_with_carry_engine random number
+       *              generator object.
+       *
+       * @returns true if the infinite sequences of generated values
+       *          would be equal, false otherwise.
+      */
+      friend bool
+      operator==(const subtract_with_carry_engine& __lhs,
+		 const subtract_with_carry_engine& __rhs)
+      { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
+
+      /**
+       * @brief Inserts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x into the output stream
+       *        @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A % subtract_with_carry_engine random number generator
+       *             engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _UIntType1, size_t __w1, size_t __s1, size_t __r1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::subtract_with_carry_engine<_UIntType1, __w1,
+		   __s1, __r1>&);
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A % subtract_with_carry_engine random number generator
+       *             engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _UIntType1, size_t __w1, size_t __s1, size_t __r1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::subtract_with_carry_engine<_UIntType1, __w1,
+		   __s1, __r1>&);
+
+    private:
+      _UIntType  _M_x[long_lag];
+      _UIntType  _M_carry;
+      size_t     _M_p;
+    };
+
+  /**
+   * @brief Compares two % subtract_with_carry_engine random number
+   *        generator objects of the same type for inequality.
+   *
+   * @param __lhs A % subtract_with_carry_engine random number generator
+   *              object.
+   * @param __rhs Another % subtract_with_carry_engine random number
+   *              generator object.
+   *
+   * @returns true if the infinite sequences of generated values
+   *          would be different, false otherwise.
+   */
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    inline bool
+    operator!=(const std::subtract_with_carry_engine<_UIntType, __w,
+	       __s, __r>& __lhs,
+	       const std::subtract_with_carry_engine<_UIntType, __w,
+	       __s, __r>& __rhs)
+    { return !(__lhs == __rhs); }
+
+
+  /**
+   * Produces random numbers from some base engine by discarding blocks of
+   * data.
+   *
+   * 0 <= @p __r <= @p __p
+   */
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    class discard_block_engine
+    {
+      static_assert(1 <= __r && __r <= __p,
+		    "template argument substituting __r out of bounds");
+
+    public:
+      /** The type of the generated random value. */
+      typedef typename _RandomNumberEngine::result_type result_type;
+
+      // parameter values
+      static constexpr size_t block_size = __p;
+      static constexpr size_t used_block = __r;
+
+      /**
+       * @brief Constructs a default %discard_block_engine engine.
+       *
+       * The underlying engine is default constructed as well.
+       */
+      discard_block_engine()
+      : _M_b(), _M_n(0) { }
+
+      /**
+       * @brief Copy constructs a %discard_block_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      discard_block_engine(const _RandomNumberEngine& __rne)
+      : _M_b(__rne), _M_n(0) { }
+
+      /**
+       * @brief Move constructs a %discard_block_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      discard_block_engine(_RandomNumberEngine&& __rne)
+      : _M_b(std::move(__rne)), _M_n(0) { }
+
+      /**
+       * @brief Seed constructs a %discard_block_engine engine.
+       *
+       * Constructs the underlying generator engine seeded with @p __s.
+       * @param __s A seed value for the base class engine.
+       */
+      explicit
+      discard_block_engine(result_type __s)
+      : _M_b(__s), _M_n(0) { }
+
+      /**
+       * @brief Generator construct a %discard_block_engine engine.
+       *
+       * @param __q A seed sequence.
+       */
+      template<typename _Sseq, typename = typename
+	std::enable_if<!std::is_same<_Sseq, discard_block_engine>::value
+		       && !std::is_same<_Sseq, _RandomNumberEngine>::value>
+	       ::type>
+        explicit
+        discard_block_engine(_Sseq& __q)
+	: _M_b(__q), _M_n(0)
+        { }
+
+      /**
+       * @brief Reseeds the %discard_block_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed()
+      {
+	_M_b.seed();
+	_M_n = 0;
+      }
+
+      /**
+       * @brief Reseeds the %discard_block_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed(result_type __s)
+      {
+	_M_b.seed(__s);
+	_M_n = 0;
+      }
+
+      /**
+       * @brief Reseeds the %discard_block_engine object with the given seed
+       *        sequence.
+       * @param __q A seed generator function.
+       */
+      template<typename _Sseq>
+        void
+        seed(_Sseq& __q)
+        {
+	  _M_b.seed(__q);
+	  _M_n = 0;
+	}
+
+      /**
+       * @brief Gets a const reference to the underlying generator engine
+       *        object.
+       */
+      const _RandomNumberEngine&
+      base() const
+      { return _M_b; }
+
+      /**
+       * @brief Gets the minimum value in the generated random number range.
+       */
+      static constexpr result_type
+      min()
+      { return _RandomNumberEngine::min(); }
+
+      /**
+       * @brief Gets the maximum value in the generated random number range.
+       */
+      static constexpr result_type
+      max()
+      { return _RandomNumberEngine::max(); }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+	for (; __z != 0ULL; --__z)
+	  (*this)();
+      }
+
+      /**
+       * @brief Gets the next value in the generated random number sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two %discard_block_engine random number generator
+       *        objects of the same type for equality.
+       *
+       * @param __lhs A %discard_block_engine random number generator object.
+       * @param __rhs Another %discard_block_engine random number generator
+       *              object.
+       *
+       * @returns true if the infinite sequences of generated values
+       *          would be equal, false otherwise.
+       */
+      friend bool
+      operator==(const discard_block_engine& __lhs,
+		 const discard_block_engine& __rhs)
+      { return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; }
+
+      /**
+       * @brief Inserts the current state of a %discard_block_engine random
+       *        number generator engine @p __x into the output stream
+       *        @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %discard_block_engine random number generator engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __p1, size_t __r1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::discard_block_engine<_RandomNumberEngine1,
+		   __p1, __r1>&);
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %discard_block_engine random number generator engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __p1, size_t __r1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::discard_block_engine<_RandomNumberEngine1,
+		   __p1, __r1>&);
+
+    private:
+      _RandomNumberEngine _M_b;
+      size_t _M_n;
+    };
+
+  /**
+   * @brief Compares two %discard_block_engine random number generator
+   *        objects of the same type for inequality.
+   *
+   * @param __lhs A %discard_block_engine random number generator object.
+   * @param __rhs Another %discard_block_engine random number generator
+   *              object.
+   *
+   * @returns true if the infinite sequences of generated values
+   *          would be different, false otherwise.
+   */
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    inline bool
+    operator!=(const std::discard_block_engine<_RandomNumberEngine, __p,
+	       __r>& __lhs,
+	       const std::discard_block_engine<_RandomNumberEngine, __p,
+	       __r>& __rhs)
+    { return !(__lhs == __rhs); }
+
+
+  /**
+   * Produces random numbers by combining random numbers from some base
+   * engine to produce random numbers with a specifies number of bits @p __w.
+   */
+  template<typename _RandomNumberEngine, size_t __w, typename _UIntType>
+    class independent_bits_engine
+    {
+      static_assert(std::is_unsigned<_UIntType>::value, "template argument "
+		    "substituting _UIntType not an unsigned integral type");
+      static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
+		    "template argument substituting __w out of bounds");
+
+    public:
+      /** The type of the generated random value. */
+      typedef _UIntType result_type;
+
+      /**
+       * @brief Constructs a default %independent_bits_engine engine.
+       *
+       * The underlying engine is default constructed as well.
+       */
+      independent_bits_engine()
+      : _M_b() { }
+
+      /**
+       * @brief Copy constructs a %independent_bits_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      independent_bits_engine(const _RandomNumberEngine& __rne)
+      : _M_b(__rne) { }
+
+      /**
+       * @brief Move constructs a %independent_bits_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      independent_bits_engine(_RandomNumberEngine&& __rne)
+      : _M_b(std::move(__rne)) { }
+
+      /**
+       * @brief Seed constructs a %independent_bits_engine engine.
+       *
+       * Constructs the underlying generator engine seeded with @p __s.
+       * @param __s A seed value for the base class engine.
+       */
+      explicit
+      independent_bits_engine(result_type __s)
+      : _M_b(__s) { }
+
+      /**
+       * @brief Generator construct a %independent_bits_engine engine.
+       *
+       * @param __q A seed sequence.
+       */
+      template<typename _Sseq, typename = typename
+	std::enable_if<!std::is_same<_Sseq, independent_bits_engine>::value
+		       && !std::is_same<_Sseq, _RandomNumberEngine>::value>
+               ::type>
+        explicit
+        independent_bits_engine(_Sseq& __q)
+        : _M_b(__q)
+        { }
+
+      /**
+       * @brief Reseeds the %independent_bits_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed()
+      { _M_b.seed(); }
+
+      /**
+       * @brief Reseeds the %independent_bits_engine object with the default
+       *        seed for the underlying base class generator engine.
+       */
+      void
+      seed(result_type __s)
+      { _M_b.seed(__s); }
+
+      /**
+       * @brief Reseeds the %independent_bits_engine object with the given
+       *        seed sequence.
+       * @param __q A seed generator function.
+       */
+      template<typename _Sseq>
+        void
+        seed(_Sseq& __q)
+        { _M_b.seed(__q); }
+
+      /**
+       * @brief Gets a const reference to the underlying generator engine
+       *        object.
+       */
+      const _RandomNumberEngine&
+      base() const
+      { return _M_b; }
+
+      /**
+       * @brief Gets the minimum value in the generated random number range.
+       */
+      static constexpr result_type
+      min()
+      { return 0U; }
+
+      /**
+       * @brief Gets the maximum value in the generated random number range.
+       */
+      static constexpr result_type
+      max()
+      { return __detail::_Shift<_UIntType, __w>::__value - 1; }
+
+      /**
+       * @brief Discard a sequence of random numbers.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+	for (; __z != 0ULL; --__z)
+	  (*this)();
+      }
+
+      /**
+       * @brief Gets the next value in the generated random number sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * @brief Compares two %independent_bits_engine random number generator
+       * objects of the same type for equality.
+       *
+       * @param __lhs A %independent_bits_engine random number generator
+       *              object.
+       * @param __rhs Another %independent_bits_engine random number generator
+       *              object.
+       *
+       * @returns true if the infinite sequences of generated values
+       *          would be equal, false otherwise.
+       */
+      friend bool
+      operator==(const independent_bits_engine& __lhs,
+		 const independent_bits_engine& __rhs)
+      { return __lhs._M_b == __rhs._M_b; }
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %independent_bits_engine random number generator
+       *             engine.
+       *
+       * @returns The input stream with the state of @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,
+		   std::independent_bits_engine<_RandomNumberEngine,
+		   __w, _UIntType>& __x)
+	{
+	  __is >> __x._M_b;
+	  return __is;
+	}
+
+    private:
+      _RandomNumberEngine _M_b;
+    };
+
+  /**
+   * @brief Compares two %independent_bits_engine random number generator
+   * objects of the same type for inequality.
+   *
+   * @param __lhs A %independent_bits_engine random number generator
+   *              object.
+   * @param __rhs Another %independent_bits_engine random number generator
+   *              object.
+   *
+   * @returns true if the infinite sequences of generated values
+   *          would be different, false otherwise.
+   */
+  template<typename _RandomNumberEngine, size_t __w, typename _UIntType>
+    inline bool
+    operator!=(const std::independent_bits_engine<_RandomNumberEngine, __w,
+	       _UIntType>& __lhs,
+	       const std::independent_bits_engine<_RandomNumberEngine, __w,
+	       _UIntType>& __rhs)
+    { return !(__lhs == __rhs); }
+
+  /**
+   * @brief Inserts the current state of a %independent_bits_engine random
+   *        number generator engine @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %independent_bits_engine random number generator engine.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   *          an error state.
+   */
+  template<typename _RandomNumberEngine, size_t __w, typename _UIntType,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const std::independent_bits_engine<_RandomNumberEngine,
+	       __w, _UIntType>& __x)
+    {
+      __os << __x.base();
+      return __os;
+    }
+
+
+  /**
+   * @brief Produces random numbers by combining random numbers from some
+   * base engine to produce random numbers with a specifies number of bits
+   * @p __w.
+   */
+  template<typename _RandomNumberEngine, size_t __k>
+    class shuffle_order_engine
+    {
+      static_assert(1u <= __k, "template argument substituting "
+		    "__k out of bound");
+
+    public:
+      /** The type of the generated random value. */
+      typedef typename _RandomNumberEngine::result_type result_type;
+
+      static constexpr size_t table_size = __k;
+
+      /**
+       * @brief Constructs a default %shuffle_order_engine engine.
+       *
+       * The underlying engine is default constructed as well.
+       */
+      shuffle_order_engine()
+      : _M_b()
+      { _M_initialize(); }
+
+      /**
+       * @brief Copy constructs a %shuffle_order_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      shuffle_order_engine(const _RandomNumberEngine& __rne)
+      : _M_b(__rne)
+      { _M_initialize(); }
+
+      /**
+       * @brief Move constructs a %shuffle_order_engine engine.
+       *
+       * Copies an existing base class random number generator.
+       * @param rng An existing (base class) engine object.
+       */
+      explicit
+      shuffle_order_engine(_RandomNumberEngine&& __rne)
+      : _M_b(std::move(__rne))
+      { _M_initialize(); }
+
+      /**
+       * @brief Seed constructs a %shuffle_order_engine engine.
+       *
+       * Constructs the underlying generator engine seeded with @p __s.
+       * @param __s A seed value for the base class engine.
+       */
+      explicit
+      shuffle_order_engine(result_type __s)
+      : _M_b(__s)
+      { _M_initialize(); }
+
+      /**
+       * @brief Generator construct a %shuffle_order_engine engine.
+       *
+       * @param __q A seed sequence.
+       */
+      template<typename _Sseq, typename = typename
+	std::enable_if<!std::is_same<_Sseq, shuffle_order_engine>::value
+		       && !std::is_same<_Sseq, _RandomNumberEngine>::value>
+	       ::type>
+        explicit
+        shuffle_order_engine(_Sseq& __q)
+        : _M_b(__q)
+        { _M_initialize(); }
+
+      /**
+       * @brief Reseeds the %shuffle_order_engine object with the default seed
+                for the underlying base class generator engine.
+       */
+      void
+      seed()
+      {
+	_M_b.seed();
+	_M_initialize();
+      }
+
+      /**
+       * @brief Reseeds the %shuffle_order_engine object with the default seed
+       *        for the underlying base class generator engine.
+       */
+      void
+      seed(result_type __s)
+      {
+	_M_b.seed(__s);
+	_M_initialize();
+      }
+
+      /**
+       * @brief Reseeds the %shuffle_order_engine object with the given seed
+       *        sequence.
+       * @param __q A seed generator function.
+       */
+      template<typename _Sseq>
+        void
+        seed(_Sseq& __q)
+        {
+	  _M_b.seed(__q);
+	  _M_initialize();
+	}
+
+      /**
+       * Gets a const reference to the underlying generator engine object.
+       */
+      const _RandomNumberEngine&
+      base() const
+      { return _M_b; }
+
+      /**
+       * Gets the minimum value in the generated random number range.
+       */
+      static constexpr result_type
+      min()
+      { return _RandomNumberEngine::min(); }
+
+      /**
+       * Gets the maximum value in the generated random number range.
+       */
+      static constexpr result_type
+      max()
+      { return _RandomNumberEngine::max(); }
+
+      /**
+       * Discard a sequence of random numbers.
+       */
+      void
+      discard(unsigned long long __z)
+      {
+	for (; __z != 0ULL; --__z)
+	  (*this)();
+      }
+
+      /**
+       * Gets the next value in the generated random number sequence.
+       */
+      result_type
+      operator()();
+
+      /**
+       * Compares two %shuffle_order_engine random number generator objects
+       * of the same type for equality.
+       *
+       * @param __lhs A %shuffle_order_engine random number generator object.
+       * @param __rhs Another %shuffle_order_engine random number generator
+       *              object.
+       *
+       * @returns true if the infinite sequences of generated values
+       *          would be equal, false otherwise.
+      */
+      friend bool
+      operator==(const shuffle_order_engine& __lhs,
+		 const shuffle_order_engine& __rhs)
+      { return __lhs._M_b == __rhs._M_b; }
+
+      /**
+       * @brief Inserts the current state of a %shuffle_order_engine random
+       *        number generator engine @p __x into the output stream
+	@p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %shuffle_order_engine random number generator engine.
+       *
+       * @returns The output stream with the state of @p __x inserted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __k1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::shuffle_order_engine<_RandomNumberEngine1,
+		   __k1>&);
+
+      /**
+       * @brief Extracts the current state of a % subtract_with_carry_engine
+       *        random number generator engine @p __x from the input stream
+       *        @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %shuffle_order_engine random number generator engine.
+       *
+       * @returns The input stream with the state of @p __x extracted or in
+       * an error state.
+       */
+      template<typename _RandomNumberEngine1, size_t __k1,
+	       typename _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::shuffle_order_engine<_RandomNumberEngine1, __k1>&);
+
+    private:
+      void _M_initialize()
+      {
+	for (size_t __i = 0; __i < __k; ++__i)
+	  _M_v[__i] = _M_b();
+	_M_y = _M_b();
+      }
+
+      _RandomNumberEngine _M_b;
+      result_type _M_v[__k];
+      result_type _M_y;
+    };
+
+  /**
+   * Compares two %shuffle_order_engine random number generator objects
+   * of the same type for inequality.
+   *
+   * @param __lhs A %shuffle_order_engine random number generator object.
+   * @param __rhs Another %shuffle_order_engine random number generator
+   *              object.
+   *
+   * @returns true if the infinite sequences of generated values
+   *          would be different, false otherwise.
+   */
+  template<typename _RandomNumberEngine, size_t __k>
+    inline bool
+    operator!=(const std::shuffle_order_engine<_RandomNumberEngine,
+	       __k>& __lhs,
+	       const std::shuffle_order_engine<_RandomNumberEngine,
+	       __k>& __rhs)
+    { return !(__lhs == __rhs); }
+
+
+  /**
+   * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.
+   */
+  typedef linear_congruential_engine<uint_fast32_t, 16807UL, 0UL, 2147483647UL>
+  minstd_rand0;
+
+  /**
+   * An alternative LCR (Lehmer Generator function).
+   */
+  typedef linear_congruential_engine<uint_fast32_t, 48271UL, 0UL, 2147483647UL>
+  minstd_rand;
+
+  /**
+   * 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_engine<
+    uint_fast32_t,
+    32, 624, 397, 31,
+    0x9908b0dfUL, 11,
+    0xffffffffUL, 7,
+    0x9d2c5680UL, 15,
+    0xefc60000UL, 18, 1812433253UL> mt19937;
+
+  /**
+   * An alternative Mersenne Twister.
+   */
+  typedef mersenne_twister_engine<
+    uint_fast64_t,
+    64, 312, 156, 31,
+    0xb5026f5aa96619e9ULL, 29,
+    0x5555555555555555ULL, 17,
+    0x71d67fffeda60000ULL, 37,
+    0xfff7eee000000000ULL, 43,
+    6364136223846793005ULL> mt19937_64;
+
+  typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>
+    ranlux24_base;
+
+  typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12>
+    ranlux48_base;
+
+  typedef discard_block_engine<ranlux24_base, 223, 23> ranlux24;
+
+  typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
+
+  typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
+
+  typedef minstd_rand0 default_random_engine;
+
+  /**
+   * A standard interface to a platform-specific non-deterministic
+   * random number generator (if any are available).
+   */
+  class random_device
+  {
+  public:
+    /** The type of the generated random value. */
+    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
+    }
+
+    // No copy functions.
+    random_device(const random_device&) = delete;
+    void operator=(const random_device&) = delete;
+
+  private:
+
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+    FILE*        _M_file;
+#else
+    mt19937      _M_mt;
+#endif
+  };
+
+  /* @} */ // group random_generators
+
+  /**
+   * @addtogroup random_distributions Random Number Distributions
+   * @ingroup random
+   * @{
+   */
+
+  /**
+   * @addtogroup random_distributions_uniform Uniform Distributions
+   * @ingroup 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_distribution
+    {
+      static_assert(std::is_integral<_IntType>::value,
+		    "template argument not an integral type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef uniform_int_distribution<_IntType> distribution_type;
+
+	explicit
+	param_type(_IntType __a = 0,
+		   _IntType __b = std::numeric_limits<_IntType>::max())
+	: _M_a(__a), _M_b(__b)
+	{
+	  _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b);
+	}
+
+	result_type
+	a() const
+	{ return _M_a; }
+
+	result_type
+	b() const
+	{ return _M_b; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+
+      private:
+	_IntType _M_a;
+	_IntType _M_b;
+      };
+
+    public:
+      /**
+       * @brief Constructs a uniform distribution object.
+       */
+      explicit
+      uniform_int_distribution(_IntType __a = 0,
+			   _IntType __b = std::numeric_limits<_IntType>::max())
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      uniform_int_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the uniform integer distribution.
+       */
+      void
+      reset() { }
+
+      result_type
+      a() const
+      { return _M_param.a(); }
+
+      result_type
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the inclusive lower bound of the distribution range.
+       */
+      result_type
+      min() const
+      { return this->a(); }
+
+      /**
+       * @brief Returns the inclusive upper bound of the distribution range.
+       */
+      result_type
+      max() const
+      { return this->b(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+        { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two uniform integer distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    inline bool
+    operator==(const std::uniform_int_distribution<_IntType>& __d1,
+	       const std::uniform_int_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Return true if two uniform integer distributions have
+   *        different parameters.
+   */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::uniform_int_distribution<_IntType>& __d1,
+	       const std::uniform_int_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief Inserts a %uniform_int_distribution random number
+   *        distribution @p __x into the output stream @p os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %uniform_int_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::uniform_int_distribution<_IntType>&);
+
+  /**
+   * @brief Extracts a %uniform_int_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %uniform_int_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::uniform_int_distribution<_IntType>&);
+
+
+  /**
+   * @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_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef uniform_real_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __a = _RealType(0),
+		   _RealType __b = _RealType(1))
+	: _M_a(__a), _M_b(__b)
+	{
+	  _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b);
+	}
+
+	result_type
+	a() const
+	{ return _M_a; }
+
+	result_type
+	b() const
+	{ return _M_b; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+
+      private:
+	_RealType _M_a;
+	_RealType _M_b;
+      };
+
+    public:
+      /**
+       * @brief Constructs a uniform_real_distribution object.
+       *
+       * @param __min [IN]  The lower bound of the distribution.
+       * @param __max [IN]  The upper bound of the distribution.
+       */
+      explicit
+      uniform_real_distribution(_RealType __a = _RealType(0),
+				_RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      uniform_real_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the uniform real distribution.
+       */
+      void
+      reset() { }
+
+      result_type
+      a() const
+      { return _M_param.a(); }
+
+      result_type
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the inclusive lower bound of the distribution range.
+       */
+      result_type
+      min() const
+      { return this->a(); }
+
+      /**
+       * @brief Returns the inclusive upper bound of the distribution range.
+       */
+      result_type
+      max() const
+      { return this->b(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+        { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p)
+	{
+	  __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	    __aurng(__urng);
+	  return (__aurng() * (__p.b() - __p.a())) + __p.a();
+	}
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two uniform real distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    inline bool
+    operator==(const std::uniform_real_distribution<_IntType>& __d1,
+	       const std::uniform_real_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Return true if two uniform real distributions have
+   *        different parameters.
+   */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::uniform_real_distribution<_IntType>& __d1,
+	       const std::uniform_real_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief Inserts a %uniform_real_distribution random number
+   *        distribution @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %uniform_real_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   *          an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::uniform_real_distribution<_RealType>&);
+
+  /**
+   * @brief Extracts a %uniform_real_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x  A %uniform_real_distribution random number generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::uniform_real_distribution<_RealType>&);
+
+  /* @} */ // group random_distributions_uniform
+
+  /**
+   * @addtogroup random_distributions_normal Normal Distributions
+   * @ingroup random_distributions
+   * @{
+   */
+
+  /**
+   * @brief A normal continuous distribution for random numbers.
+   *
+   * The formula for the normal probability density function is
+   * @f[
+   *     p(x|\mu,\sigma) = \frac{1}{\sigma \sqrt{2 \pi}}
+   *            e^{- \frac{{x - \mu}^ {2}}{2 \sigma ^ {2}} } 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class normal_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef normal_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __mean = _RealType(0),
+		   _RealType __stddev = _RealType(1))
+	: _M_mean(__mean), _M_stddev(__stddev)
+	{
+	  _GLIBCXX_DEBUG_ASSERT(_M_stddev > _RealType(0));
+	}
+
+	_RealType
+	mean() const
+	{ return _M_mean; }
+
+	_RealType
+	stddev() const
+	{ return _M_stddev; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return (__p1._M_mean == __p2._M_mean
+		  && __p1._M_stddev == __p2._M_stddev); }
+
+      private:
+	_RealType _M_mean;
+	_RealType _M_stddev;
+      };
+
+    public:
+      /**
+       * Constructs a normal distribution with parameters @f$mean@f$ and
+       * standard deviation.
+       */
+      explicit
+      normal_distribution(result_type __mean = result_type(0),
+			  result_type __stddev = result_type(1))
+      : _M_param(__mean, __stddev), _M_saved_available(false)
+      { }
+
+      explicit
+      normal_distribution(const param_type& __p)
+      : _M_param(__p), _M_saved_available(false)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_saved_available = false; }
+
+      /**
+       * @brief Returns the mean of the distribution.
+       */
+      _RealType
+      mean() const
+      { return _M_param.mean(); }
+
+      /**
+       * @brief Returns the standard deviation of the distribution.
+       */
+      _RealType
+      stddev() const
+      { return _M_param.stddev(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Return true if two normal distributions have
+       *        the same parameters and the sequences that would
+       *        be generated are equal.
+       */
+      template<typename _RealType1>
+	friend bool
+        operator==(const std::normal_distribution<_RealType1>& __d1,
+		   const std::normal_distribution<_RealType1>& __d2);
+
+      /**
+       * @brief 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>&,
+		   const std::normal_distribution<_RealType1>&);
+
+      /**
+       * @brief 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>&,
+		   std::normal_distribution<_RealType1>&);
+
+    private:
+      param_type  _M_param;
+      result_type _M_saved;
+      bool        _M_saved_available;
+    };
+
+  /**
+   * @brief Return true if two normal distributions are different.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::normal_distribution<_RealType>& __d1,
+	       const std::normal_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A lognormal_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f[
+   *     p(x|m,s) = \frac{1}{sx\sqrt{2\pi}}
+   *                \exp{-\frac{(\ln{x} - m)^2}{2s^2}} 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class lognormal_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef lognormal_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __m = _RealType(0),
+		   _RealType __s = _RealType(1))
+	: _M_m(__m), _M_s(__s)
+	{ }
+
+	_RealType
+	m() const
+	{ return _M_m; }
+
+	_RealType
+	s() const
+	{ return _M_s; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; }
+
+      private:
+	_RealType _M_m;
+	_RealType _M_s;
+      };
+
+      explicit
+      lognormal_distribution(_RealType __m = _RealType(0),
+			     _RealType __s = _RealType(1))
+      : _M_param(__m, __s), _M_nd()
+      { }
+
+      explicit
+      lognormal_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd()
+      { }
+
+      /**
+       * Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_nd.reset(); }
+
+      /**
+       *
+       */
+      _RealType
+      m() const
+      { return _M_param.m(); }
+
+      _RealType
+      s() const
+      { return _M_param.s(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p)
+        { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
+
+      /**
+       * @brief Return true if two lognormal distributions have
+       *        the same parameters and the sequences that would
+       *        be generated are equal.
+       */
+      template<typename _RealType1>
+        friend bool
+        operator==(const std::lognormal_distribution<_RealType1>& __d1,
+		   const std::lognormal_distribution<_RealType1>& __d2)
+        { return (__d1.param() == __d2.param()
+		  && __d1._M_nd == __d2._M_nd); }
+
+      /**
+       * @brief Inserts a %lognormal_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %lognormal_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>&,
+		   const std::lognormal_distribution<_RealType1>&);
+
+      /**
+       * @brief Extracts a %lognormal_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %lognormal_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>&,
+		   std::lognormal_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+
+      std::normal_distribution<result_type> _M_nd;
+    };
+
+  /**
+   * @brief Return true if two lognormal distributions are different.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::lognormal_distribution<_RealType>& __d1,
+	       const std::lognormal_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A gamma continuous distribution for random numbers.
+   *
+   * The formula for the gamma probability density function is:
+   * @f[
+   *     p(x|\alpha,\beta) = \frac{1}{\beta\Gamma(\alpha)}
+   *                         (x/\beta)^{\alpha - 1} e^{-x/\beta} 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class gamma_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef gamma_distribution<_RealType> distribution_type;
+	friend class gamma_distribution<_RealType>;
+
+	explicit
+	param_type(_RealType __alpha_val = _RealType(1),
+		   _RealType __beta_val = _RealType(1))
+	: _M_alpha(__alpha_val), _M_beta(__beta_val)
+	{
+	  _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0));
+	  _M_initialize();
+	}
+
+	_RealType
+	alpha() const
+	{ return _M_alpha; }
+
+	_RealType
+	beta() const
+	{ return _M_beta; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return (__p1._M_alpha == __p2._M_alpha
+		  && __p1._M_beta == __p2._M_beta); }
+
+      private:
+	void
+	_M_initialize();
+
+	_RealType _M_alpha;
+	_RealType _M_beta;
+
+	_RealType _M_malpha, _M_a2;
+      };
+
+    public:
+      /**
+       * @brief Constructs a gamma distribution with parameters
+       * @f$\alpha@f$ and @f$\beta@f$.
+       */
+      explicit
+      gamma_distribution(_RealType __alpha_val = _RealType(1),
+			 _RealType __beta_val = _RealType(1))
+      : _M_param(__alpha_val, __beta_val), _M_nd()
+      { }
+
+      explicit
+      gamma_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd()
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_nd.reset(); }
+
+      /**
+       * @brief Returns the @f$\alpha@f$ of the distribution.
+       */
+      _RealType
+      alpha() const
+      { return _M_param.alpha(); }
+
+      /**
+       * @brief Returns the @f$\beta@f$ of the distribution.
+       */
+      _RealType
+      beta() const
+      { return _M_param.beta(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Return true if two gamma distributions have the same
+       *        parameters and the sequences that would be generated
+       *        are equal.
+       */
+      template<typename _RealType1>
+        friend bool
+        operator==(const std::gamma_distribution<_RealType1>& __d1,
+		   const std::gamma_distribution<_RealType1>& __d2)
+        { return (__d1.param() == __d2.param()
+		  && __d1._M_nd == __d2._M_nd); }
+
+      /**
+       * @brief 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>&,
+		   const std::gamma_distribution<_RealType1>&);
+
+      /**
+       * @brief 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 _RealType1, typename _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::gamma_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+
+      std::normal_distribution<result_type> _M_nd;
+    };
+
+  /**
+   * @brief Return true if two gamma distributions are different.
+   */
+   template<typename _RealType>
+    inline bool
+     operator!=(const std::gamma_distribution<_RealType>& __d1,
+		const std::gamma_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A chi_squared_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$p(x|n) = \frac{x^{(n/2) - 1}e^{-x/2}}{\Gamma(n/2) 2^{n/2}}@f$
+   */
+  template<typename _RealType = double>
+    class chi_squared_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef chi_squared_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __n = _RealType(1))
+	: _M_n(__n)
+	{ }
+
+	_RealType
+	n() const
+	{ return _M_n; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_n == __p2._M_n; }
+
+      private:
+	_RealType _M_n;
+      };
+
+      explicit
+      chi_squared_distribution(_RealType __n = _RealType(1))
+      : _M_param(__n), _M_gd(__n / 2)
+      { }
+
+      explicit
+      chi_squared_distribution(const param_type& __p)
+      : _M_param(__p), _M_gd(__p.n() / 2)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_gd.reset(); }
+
+      /**
+       *
+       */
+      _RealType
+      n() const
+      { return _M_param.n(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return 2 * _M_gd(__urng); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p)
+        {
+	  typedef typename std::gamma_distribution<result_type>::param_type
+	    param_type;
+	  return 2 * _M_gd(__urng, param_type(__p.n() / 2));
+	}
+
+      /**
+       * @brief Return true if two Chi-squared distributions have
+       *        the same parameters and the sequences that would be
+       *        generated are equal.
+       */
+      template<typename _RealType1>
+        friend bool
+        operator==(const std::chi_squared_distribution<_RealType1>& __d1,
+		   const std::chi_squared_distribution<_RealType1>& __d2)
+        { return __d1.param() == __d2.param() && __d1._M_gd == __d2._M_gd; }
+
+      /**
+       * @brief Inserts a %chi_squared_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %chi_squared_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>&,
+		   const std::chi_squared_distribution<_RealType1>&);
+
+      /**
+       * @brief Extracts a %chi_squared_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %chi_squared_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>&,
+		   std::chi_squared_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+
+      std::gamma_distribution<result_type> _M_gd;
+    };
+
+  /**
+   * @brief Return true if two Chi-squared distributions are different.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::chi_squared_distribution<_RealType>& __d1,
+	       const std::chi_squared_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A cauchy_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f$p(x|a,b) = (\pi b (1 + (\frac{x-a}{b})^2))^{-1}@f$
+   */
+  template<typename _RealType = double>
+    class cauchy_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef cauchy_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __a = _RealType(0),
+		   _RealType __b = _RealType(1))
+	: _M_a(__a), _M_b(__b)
+	{ }
+
+	_RealType
+	a() const
+	{ return _M_a; }
+
+	_RealType
+	b() const
+	{ return _M_b; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+
+      private:
+	_RealType _M_a;
+	_RealType _M_b;
+      };
+
+      explicit
+      cauchy_distribution(_RealType __a = _RealType(0),
+			  _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      cauchy_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       *
+       */
+      _RealType
+      a() const
+      { return _M_param.a(); }
+
+      _RealType
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two Cauchy distributions have
+   *        the same parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator==(const std::cauchy_distribution<_RealType>& __d1,
+	       const std::cauchy_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Return true if two Cauchy distributions have
+   *        different parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::cauchy_distribution<_RealType>& __d1,
+	       const std::cauchy_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief Inserts a %cauchy_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %cauchy_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::cauchy_distribution<_RealType>&);
+
+  /**
+   * @brief Extracts a %cauchy_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %cauchy_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::cauchy_distribution<_RealType>&);
+
+
+  /**
+   * @brief A fisher_f_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f[
+   *     p(x|m,n) = \frac{\Gamma((m+n)/2)}{\Gamma(m/2)\Gamma(n/2)}
+   *                (\frac{m}{n})^{m/2} x^{(m/2)-1}
+   *                (1 + \frac{mx}{n})^{-(m+n)/2} 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class fisher_f_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef fisher_f_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __m = _RealType(1),
+		   _RealType __n = _RealType(1))
+	: _M_m(__m), _M_n(__n)
+	{ }
+
+	_RealType
+	m() const
+	{ return _M_m; }
+
+	_RealType
+	n() const
+	{ return _M_n; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; }
+
+      private:
+	_RealType _M_m;
+	_RealType _M_n;
+      };
+
+      explicit
+      fisher_f_distribution(_RealType __m = _RealType(1),
+			    _RealType __n = _RealType(1))
+      : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2)
+      { }
+
+      explicit
+      fisher_f_distribution(const param_type& __p)
+      : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      {
+	_M_gd_x.reset();
+	_M_gd_y.reset();
+      }
+
+      /**
+       *
+       */
+      _RealType
+      m() const
+      { return _M_param.m(); }
+
+      _RealType
+      n() const
+      { return _M_param.n(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p)
+        {
+	  typedef typename std::gamma_distribution<result_type>::param_type
+	    param_type;
+	  return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n())
+		  / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m()));
+	}
+
+      /**
+       * @brief Return true if two Fisher f distributions have
+       *        the same parameters and the sequences that would
+       *        be generated are equal.
+       */
+      template<typename _RealType1>
+        friend bool
+        operator==(const std::fisher_f_distribution<_RealType1>& __d1,
+		   const std::fisher_f_distribution<_RealType1>& __d2)
+        { return (__d1.param() == __d2.param()
+		  && __d1._M_gd_x == __d2._M_gd_x
+		  && __d1._M_gd_y == __d2._M_gd_y); }
+
+      /**
+       * @brief Inserts a %fisher_f_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %fisher_f_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>&,
+		   const std::fisher_f_distribution<_RealType1>&);
+
+      /**
+       * @brief Extracts a %fisher_f_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %fisher_f_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>&,
+		   std::fisher_f_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+
+      std::gamma_distribution<result_type> _M_gd_x, _M_gd_y;
+    };
+
+  /**
+   * @brief Return true if two Fisher f distributions are diferent.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::fisher_f_distribution<_RealType>& __d1,
+	       const std::fisher_f_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief A student_t_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is:
+   * @f[
+   *     p(x|n) = \frac{1}{\sqrt(n\pi)} \frac{\Gamma((n+1)/2)}{\Gamma(n/2)}
+   *              (1 + \frac{x^2}{n}) ^{-(n+1)/2} 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class student_t_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef student_t_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __n = _RealType(1))
+	: _M_n(__n)
+	{ }
+
+	_RealType
+	n() const
+	{ return _M_n; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_n == __p2._M_n; }
+
+      private:
+	_RealType _M_n;
+      };
+
+      explicit
+      student_t_distribution(_RealType __n = _RealType(1))
+      : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2)
+      { }
+
+      explicit
+      student_t_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      {
+	_M_nd.reset();
+	_M_gd.reset();
+      }
+
+      /**
+       *
+       */
+      _RealType
+      n() const
+      { return _M_param.n(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+        operator()(_UniformRandomNumberGenerator& __urng)
+        { return _M_nd(__urng) * std::sqrt(n() / _M_gd(__urng)); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p)
+        {
+	  typedef typename std::gamma_distribution<result_type>::param_type
+	    param_type;
+	
+	  const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2));
+	  return _M_nd(__urng) * std::sqrt(__p.n() / __g);
+        }
+
+      /**
+       * @brief Return true if two Student t distributions have
+       *        the same parameters and the sequences that would
+       *        be generated are equal.
+       */
+      template<typename _RealType1>
+        friend bool
+        operator==(const std::student_t_distribution<_RealType1>& __d1,
+		   const std::student_t_distribution<_RealType1>& __d2)
+        { return (__d1.param() == __d2.param()
+		  && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); }
+
+      /**
+       * @brief Inserts a %student_t_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %student_t_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>&,
+		   const std::student_t_distribution<_RealType1>&);
+
+      /**
+       * @brief Extracts a %student_t_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %student_t_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>&,
+		   std::student_t_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+
+      std::normal_distribution<result_type> _M_nd;
+      std::gamma_distribution<result_type> _M_gd;
+    };
+
+  /**
+   * @brief Return true if two Student t distributions are different.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::student_t_distribution<_RealType>& __d1,
+	       const std::student_t_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /* @} */ // group random_distributions_normal
+
+  /**
+   * @addtogroup random_distributions_bernoulli Bernoulli Distributions
+   * @ingroup random_distributions
+   * @{
+   */
+
+  /**
+   * @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:
+    /** The type of the range of the distribution. */
+    typedef bool result_type;
+    /** Parameter type. */
+    struct param_type
+    {
+      typedef bernoulli_distribution distribution_type;
+
+      explicit
+      param_type(double __p = 0.5)
+      : _M_p(__p)
+      {
+	_GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));
+      }
+
+      double
+      p() const
+      { return _M_p; }
+
+      friend bool
+      operator==(const param_type& __p1, const param_type& __p2)
+      { return __p1._M_p == __p2._M_p; }
+
+    private:
+      double _M_p;
+    };
+
+  public:
+    /**
+     * @brief 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_param(__p)
+    { }
+
+    explicit
+    bernoulli_distribution(const param_type& __p)
+    : _M_param(__p)
+    { }
+
+    /**
+     * @brief Resets the distribution state.
+     *
+     * Does nothing for a Bernoulli distribution.
+     */
+    void
+    reset() { }
+
+    /**
+     * @brief Returns the @p p parameter of the distribution.
+     */
+    double
+    p() const
+    { return _M_param.p(); }
+
+    /**
+     * @brief Returns the parameter set of the distribution.
+     */
+    param_type
+    param() const
+    { return _M_param; }
+
+    /**
+     * @brief Sets the parameter set of the distribution.
+     * @param __param The new parameter set of the distribution.
+     */
+    void
+    param(const param_type& __param)
+    { _M_param = __param; }
+
+    /**
+     * @brief Returns the greatest lower bound value of the distribution.
+     */
+    result_type
+    min() const
+    { return std::numeric_limits<result_type>::min(); }
+
+    /**
+     * @brief Returns the least upper bound value of the distribution.
+     */
+    result_type
+    max() const
+    { return std::numeric_limits<result_type>::max(); }
+
+    /**
+     * @brief Generating functions.
+     */
+    template<typename _UniformRandomNumberGenerator>
+      result_type
+      operator()(_UniformRandomNumberGenerator& __urng)
+      { return this->operator()(__urng, this->param()); }
+
+    template<typename _UniformRandomNumberGenerator>
+      result_type
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __p)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+	if ((__aurng() - __aurng.min())
+	     < __p.p() * (__aurng.max() - __aurng.min()))
+	  return true;
+	return false;
+      }
+
+  private:
+    param_type _M_param;
+  };
+
+  /**
+   * @brief Return true if two Bernoulli distributions have
+   *        the same parameters.
+   */
+  inline bool
+  operator==(const std::bernoulli_distribution& __d1,
+	     const std::bernoulli_distribution& __d2)
+  { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Return true if two Bernoulli distributions have
+   *        different parameters.
+   */
+  inline bool
+  operator!=(const std::bernoulli_distribution& __d1,
+	     const std::bernoulli_distribution& __d2)
+  { return !(__d1 == __d2); }
+
+  /**
+   * @brief 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>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::bernoulli_distribution&);
+
+  /**
+   * @brief 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>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       std::bernoulli_distribution& __x)
+    {
+      double __p;
+      __is >> __p;
+      __x.param(bernoulli_distribution::param_type(__p));
+      return __is;
+    }
+
+
+  /**
+   * @brief A discrete binomial random number distribution.
+   *
+   * The formula for the binomial probability density function is
+   * @f$p(i|t,p) = \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>
+    class binomial_distribution
+    {
+      static_assert(std::is_integral<_IntType>::value,
+		    "template argument not an integral type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef binomial_distribution<_IntType> distribution_type;
+	friend class binomial_distribution<_IntType>;
+
+	explicit
+	param_type(_IntType __t = _IntType(1), double __p = 0.5)
+	: _M_t(__t), _M_p(__p)
+	{
+	  _GLIBCXX_DEBUG_ASSERT((_M_t >= _IntType(0))
+				&& (_M_p >= 0.0)
+				&& (_M_p <= 1.0));
+	  _M_initialize();
+	}
+
+	_IntType
+	t() const
+	{ return _M_t; }
+
+	double
+	p() const
+	{ return _M_p; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; }
+
+      private:
+	void
+	_M_initialize();
+
+	_IntType _M_t;
+	double _M_p;
+
+	double _M_q;
+#if _GLIBCXX_USE_C99_MATH_TR1
+	double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
+	       _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
+#endif
+	bool   _M_easy;
+      };
+
+      // constructors and member function
+      explicit
+      binomial_distribution(_IntType __t = _IntType(1),
+			    double __p = 0.5)
+      : _M_param(__t, __p), _M_nd()
+      { }
+
+      explicit
+      binomial_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd()
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_nd.reset(); }
+
+      /**
+       * @brief Returns the distribution @p t parameter.
+       */
+      _IntType
+      t() const
+      { return _M_param.t(); }
+
+      /**
+       * @brief Returns the distribution @p p parameter.
+       */
+      double
+      p() const
+      { return _M_param.p(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return _M_param.t(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Return true if two binomial distributions have
+       *        the same parameters and the sequences that would
+       *        be generated are equal.
+       */
+      template<typename _IntType1>
+	friend bool
+        operator==(const std::binomial_distribution<_IntType1>& __d1,
+		   const std::binomial_distribution<_IntType1>& __d2)
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+	{ return __d1.param() == __d2.param() && __d1._M_nd == __d2._M_nd; }
+#else
+        { return __d1.param() == __d2.param(); }
+#endif
+
+      /**
+       * @brief 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 _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::binomial_distribution<_IntType1>&);
+
+      /**
+       * @brief 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 _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::binomial_distribution<_IntType1>&);
+
+    private:
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	_M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t);
+
+      param_type _M_param;
+
+      // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+      std::normal_distribution<double> _M_nd;
+    };
+
+  /**
+   * @brief Return true if two binomial distributions are different.
+   */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::binomial_distribution<_IntType>& __d1,
+	       const std::binomial_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A discrete geometric random number distribution.
+   *
+   * The formula for the geometric probability density function is
+   * @f$p(i|p) = p(1 - p)^{i}@f$ where @f$p@f$ is the parameter of the
+   * distribution.
+   */
+  template<typename _IntType = int>
+    class geometric_distribution
+    {
+      static_assert(std::is_integral<_IntType>::value,
+		    "template argument not an integral type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType  result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef geometric_distribution<_IntType> distribution_type;
+	friend class geometric_distribution<_IntType>;
+
+	explicit
+	param_type(double __p = 0.5)
+	: _M_p(__p)
+	{
+	  _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0)
+			     && (_M_p < 1.0));
+	  _M_initialize();
+	}
+
+	double
+	p() const
+	{ return _M_p; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_p == __p2._M_p; }
+
+      private:
+	void
+	_M_initialize()
+	{ _M_log_1_p = std::log(1.0 - _M_p); }
+
+	double _M_p;
+
+	double _M_log_1_p;
+      };
+
+      // constructors and member function
+      explicit
+      geometric_distribution(double __p = 0.5)
+      : _M_param(__p)
+      { }
+
+      explicit
+      geometric_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Does nothing for the geometric distribution.
+       */
+      void
+      reset() { }
+
+      /**
+       * @brief Returns the distribution parameter @p p.
+       */
+      double
+      p() const
+      { return _M_param.p(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two geometric distributions have
+   *        the same parameters.
+   */
+  template<typename _IntType>
+    inline bool
+    operator==(const std::geometric_distribution<_IntType>& __d1,
+	       const std::geometric_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Return true if two geometric distributions have
+   *        different parameters.
+   */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::geometric_distribution<_IntType>& __d1,
+	       const std::geometric_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief 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 _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::geometric_distribution<_IntType>&);
+
+  /**
+   * @brief 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 _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::geometric_distribution<_IntType>&);
+
+
+  /**
+   * @brief A negative_binomial_distribution random number distribution.
+   *
+   * The formula for the negative 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>
+    class negative_binomial_distribution
+    {
+      static_assert(std::is_integral<_IntType>::value,
+		    "template argument not an integral type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef negative_binomial_distribution<_IntType> distribution_type;
+
+	explicit
+	param_type(_IntType __k = 1, double __p = 0.5)
+	: _M_k(__k), _M_p(__p)
+	{
+	  _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
+	}
+
+	_IntType
+	k() const
+	{ return _M_k; }
+
+	double
+	p() const
+	{ return _M_p; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; }
+
+      private:
+	_IntType _M_k;
+	double _M_p;
+      };
+
+      explicit
+      negative_binomial_distribution(_IntType __k = 1, double __p = 0.5)
+      : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
+      { }
+
+      explicit
+      negative_binomial_distribution(const param_type& __p)
+      : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p())
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_gd.reset(); }
+
+      /**
+       * @brief Return the @f$k@f$ parameter of the distribution.
+       */
+      _IntType
+      k() const
+      { return _M_param.k(); }
+
+      /**
+       * @brief Return the @f$p@f$ parameter of the distribution.
+       */
+      double
+      p() const
+      { return _M_param.p(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+        operator()(_UniformRandomNumberGenerator& __urng);
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Return true if two negative binomial distributions have
+       *        the same parameters and the sequences that would be
+       *        generated are equal.
+       */
+      template<typename _IntType1>
+        friend bool
+        operator==(const std::negative_binomial_distribution<_IntType1>& __d1,
+		   const std::negative_binomial_distribution<_IntType1>& __d2)
+        { return __d1.param() == __d2.param() && __d1._M_gd == __d2._M_gd; }
+
+      /**
+       * @brief Inserts a %negative_binomial_distribution random
+       *        number distribution @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %negative_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 _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::negative_binomial_distribution<_IntType1>&);
+
+      /**
+       * @brief Extracts a %negative_binomial_distribution random number
+       *        distribution @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %negative_binomial_distribution 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>&,
+		   std::negative_binomial_distribution<_IntType1>&);
+
+    private:
+      param_type _M_param;
+
+      std::gamma_distribution<double> _M_gd;
+    };
+
+  /**
+   * @brief Return true if two negative binomial distributions are different.
+   */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::negative_binomial_distribution<_IntType>& __d1,
+	       const std::negative_binomial_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /* @} */ // group random_distributions_bernoulli
+
+  /**
+   * @addtogroup random_distributions_poisson Poisson Distributions
+   * @ingroup random_distributions
+   * @{
+   */
+
+  /**
+   * @brief A discrete Poisson random number distribution.
+   *
+   * The formula for the Poisson probability density function is
+   * @f$p(i|\mu) = \frac{\mu^i}{i!} e^{-\mu}@f$ where @f$\mu@f$ is the
+   * parameter of the distribution.
+   */
+  template<typename _IntType = int>
+    class poisson_distribution
+    {
+      static_assert(std::is_integral<_IntType>::value,
+		    "template argument not an integral type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType  result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef poisson_distribution<_IntType> distribution_type;
+	friend class poisson_distribution<_IntType>;
+
+	explicit
+	param_type(double __mean = 1.0)
+	: _M_mean(__mean)
+	{
+	  _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);
+	  _M_initialize();
+	}
+
+	double
+	mean() const
+	{ return _M_mean; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_mean == __p2._M_mean; }
+
+      private:
+	// Hosts either log(mean) or the threshold of the simple method.
+	void
+	_M_initialize();
+
+	double _M_mean;
+
+	double _M_lm_thr;
+#if _GLIBCXX_USE_C99_MATH_TR1
+	double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
+#endif
+      };
+
+      // constructors and member function
+      explicit
+      poisson_distribution(double __mean = 1.0)
+      : _M_param(__mean), _M_nd()
+      { }
+
+      explicit
+      poisson_distribution(const param_type& __p)
+      : _M_param(__p), _M_nd()
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { _M_nd.reset(); }
+
+      /**
+       * @brief Returns the distribution parameter @p mean.
+       */
+      double
+      mean() const
+      { return _M_param.mean(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return 0; }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+       /**
+	* @brief Return true if two Poisson distributions have the same
+	*        parameters and the sequences that would be generated
+	*        are equal.
+	*/
+      template<typename _IntType1>
+        friend bool
+        operator==(const std::poisson_distribution<_IntType1>& __d1,
+		   const std::poisson_distribution<_IntType1>& __d2)
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
+        { return __d1.param() == __d2.param() && __d1._M_nd == __d2._M_nd; }
+#else
+        { return __d1.param() == __d2.param(); }
+#endif
+
+      /**
+       * @brief 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 _CharT, typename _Traits>
+	friend std::basic_ostream<_CharT, _Traits>&
+	operator<<(std::basic_ostream<_CharT, _Traits>&,
+		   const std::poisson_distribution<_IntType1>&);
+
+      /**
+       * @brief 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 _CharT, typename _Traits>
+	friend std::basic_istream<_CharT, _Traits>&
+	operator>>(std::basic_istream<_CharT, _Traits>&,
+		   std::poisson_distribution<_IntType1>&);
+
+    private:
+      param_type _M_param;
+
+      // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+      std::normal_distribution<double> _M_nd;
+    };
+
+  /**
+   * @brief Return true if two Poisson distributions are different.
+   */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::poisson_distribution<_IntType>& __d1,
+	       const std::poisson_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief An exponential continuous distribution for random numbers.
+   *
+   * The formula for the exponential probability density function is
+   * @f$p(x|\lambda) = \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
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef exponential_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __lambda = _RealType(1))
+	: _M_lambda(__lambda)
+	{
+	  _GLIBCXX_DEBUG_ASSERT(_M_lambda > _RealType(0));
+	}
+
+	_RealType
+	lambda() const
+	{ return _M_lambda; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_lambda == __p2._M_lambda; }
+
+      private:
+	_RealType _M_lambda;
+      };
+
+    public:
+      /**
+       * @brief Constructs an exponential distribution with inverse scale
+       *        parameter @f$\lambda@f$.
+       */
+      explicit
+      exponential_distribution(const result_type& __lambda = result_type(1))
+      : _M_param(__lambda)
+      { }
+
+      explicit
+      exponential_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       *
+       * Has no effect on exponential distributions.
+       */
+      void
+      reset() { }
+
+      /**
+       * @brief Returns the inverse scale parameter of the distribution.
+       */
+      _RealType
+      lambda() const
+      { return _M_param.lambda(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+        { return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p)
+	{
+	  __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	    __aurng(__urng);
+	  return -std::log(__aurng()) / __p.lambda();
+	}
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+   * @brief Return true if two exponential distributions have the same
+   *        parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator==(const std::exponential_distribution<_RealType>& __d1,
+	       const std::exponential_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+   * @brief Return true if two exponential distributions have different
+   *        parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::exponential_distribution<_RealType>& __d1,
+	       const std::exponential_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief 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 _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::exponential_distribution<_RealType>&);
+
+  /**
+   * @brief 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 _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::exponential_distribution<_RealType>&);
+
+
+  /**
+   * @brief A weibull_distribution random number distribution.
+   *
+   * The formula for the normal probability density function is:
+   * @f[
+   *     p(x|\alpha,\beta) = \frac{\alpha}{\beta} (\frac{x}{\beta})^{\alpha-1}
+   *                         \exp{(-(\frac{x}{\beta})^\alpha)} 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class weibull_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef weibull_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __a = _RealType(1),
+		   _RealType __b = _RealType(1))
+	: _M_a(__a), _M_b(__b)
+	{ }
+
+	_RealType
+	a() const
+	{ return _M_a; }
+
+	_RealType
+	b() const
+	{ return _M_b; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+
+      private:
+	_RealType _M_a;
+	_RealType _M_b;
+      };
+
+      explicit
+      weibull_distribution(_RealType __a = _RealType(1),
+			   _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      weibull_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the @f$a@f$ parameter of the distribution.
+       */
+      _RealType
+      a() const
+      { return _M_param.a(); }
+
+      /**
+       * @brief Return the @f$b@f$ parameter of the distribution.
+       */
+      _RealType
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+   /**
+    * @brief Return true if two Weibull distributions have the same
+    *        parameters.
+    */
+  template<typename _RealType>
+    inline bool
+    operator==(const std::weibull_distribution<_RealType>& __d1,
+	       const std::weibull_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+   /**
+    * @brief Return true if two Weibull distributions have different
+    *        parameters.
+    */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::weibull_distribution<_RealType>& __d1,
+	       const std::weibull_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief Inserts a %weibull_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %weibull_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::weibull_distribution<_RealType>&);
+
+  /**
+   * @brief Extracts a %weibull_distribution random number distribution
+   * @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %weibull_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::weibull_distribution<_RealType>&);
+
+
+  /**
+   * @brief A extreme_value_distribution random number distribution.
+   *
+   * The formula for the normal probability mass function is
+   * @f[
+   *     p(x|a,b) = \frac{1}{b}
+   *                \exp( \frac{a-x}{b} - \exp(\frac{a-x}{b})) 
+   * @f]
+   */
+  template<typename _RealType = double>
+    class extreme_value_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef extreme_value_distribution<_RealType> distribution_type;
+
+	explicit
+	param_type(_RealType __a = _RealType(0),
+		   _RealType __b = _RealType(1))
+	: _M_a(__a), _M_b(__b)
+	{ }
+
+	_RealType
+	a() const
+	{ return _M_a; }
+
+	_RealType
+	b() const
+	{ return _M_b; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
+
+      private:
+	_RealType _M_a;
+	_RealType _M_b;
+      };
+
+      explicit
+      extreme_value_distribution(_RealType __a = _RealType(0),
+				 _RealType __b = _RealType(1))
+      : _M_param(__a, __b)
+      { }
+
+      explicit
+      extreme_value_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the @f$a@f$ parameter of the distribution.
+       */
+      _RealType
+      a() const
+      { return _M_param.a(); }
+
+      /**
+       * @brief Return the @f$b@f$ parameter of the distribution.
+       */
+      _RealType
+      b() const
+      { return _M_param.b(); }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return std::numeric_limits<result_type>::min(); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      { return std::numeric_limits<result_type>::max(); }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+    * @brief Return true if two extreme value distributions have the same
+    *        parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator==(const std::extreme_value_distribution<_RealType>& __d1,
+	       const std::extreme_value_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+    * @brief Return true if two extreme value distributions have different
+    *        parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::extreme_value_distribution<_RealType>& __d1,
+	       const std::extreme_value_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+  /**
+   * @brief Inserts a %extreme_value_distribution random number distribution
+   * @p __x into the output stream @p __os.
+   *
+   * @param __os An output stream.
+   * @param __x  A %extreme_value_distribution random number distribution.
+   *
+   * @returns The output stream with the state of @p __x inserted or in
+   * an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>&,
+	       const std::extreme_value_distribution<_RealType>&);
+
+  /**
+   * @brief Extracts a %extreme_value_distribution random number
+   *        distribution @p __x from the input stream @p __is.
+   *
+   * @param __is An input stream.
+   * @param __x A %extreme_value_distribution random number
+   *            generator engine.
+   *
+   * @returns The input stream with @p __x extracted or in an error state.
+   */
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>&,
+	       std::extreme_value_distribution<_RealType>&);
+
+
+  /**
+   * @brief A discrete_distribution random number distribution.
+   *
+   * The formula for the discrete probability mass function is
+   *
+   */
+  template<typename _IntType = int>
+    class discrete_distribution
+    {
+      static_assert(std::is_integral<_IntType>::value,
+		    "template argument not an integral type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _IntType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef discrete_distribution<_IntType> distribution_type;
+	friend class discrete_distribution<_IntType>;
+
+	param_type()
+	: _M_prob(), _M_cp()
+	{ }
+
+	template<typename _InputIterator>
+	  param_type(_InputIterator __wbegin,
+		     _InputIterator __wend)
+	  : _M_prob(__wbegin, __wend), _M_cp()
+	  { _M_initialize(); }
+
+	param_type(initializer_list<double> __wil)
+	: _M_prob(__wil.begin(), __wil.end()), _M_cp()
+	{ _M_initialize(); }
+
+	template<typename _Func>
+	  param_type(size_t __nw, double __xmin, double __xmax,
+		     _Func __fw);
+
+	// See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/
+	param_type(const param_type&) = default;
+	param_type& operator=(const param_type&) = default;
+
+	std::vector<double>
+	probabilities() const
+	{ return _M_prob.empty() ? std::vector<double>(1, 1.0) : _M_prob; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_prob == __p2._M_prob; }
+
+      private:
+	void
+	_M_initialize();
+
+	std::vector<double> _M_prob;
+	std::vector<double> _M_cp;
+      };
+
+      discrete_distribution()
+      : _M_param()
+      { }
+
+      template<typename _InputIterator>
+	discrete_distribution(_InputIterator __wbegin,
+			      _InputIterator __wend)
+	: _M_param(__wbegin, __wend)
+	{ }
+
+      discrete_distribution(initializer_list<double> __wl)
+      : _M_param(__wl)
+      { }
+
+      template<typename _Func>
+	discrete_distribution(size_t __nw, double __xmin, double __xmax,
+			      _Func __fw)
+	: _M_param(__nw, __xmin, __xmax, __fw)
+	{ }
+
+      explicit
+      discrete_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Returns the probabilities of the distribution.
+       */
+      std::vector<double>
+      probabilities() const
+      {
+	return _M_param._M_prob.empty()
+	  ? std::vector<double>(1, 1.0) : _M_param._M_prob;
+      }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      { return result_type(0); }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      {
+	return _M_param._M_prob.empty()
+	  ? result_type(0) : result_type(_M_param._M_prob.size() - 1);
+      }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Inserts a %discrete_distribution random number distribution
+       * @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %discrete_distribution 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>&,
+		   const std::discrete_distribution<_IntType1>&);
+
+      /**
+       * @brief Extracts a %discrete_distribution random number distribution
+       * @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %discrete_distribution 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>&,
+		   std::discrete_distribution<_IntType1>&);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+    * @brief Return true if two discrete distributions have the same
+    *        parameters.
+    */
+  template<typename _IntType>
+    inline bool
+    operator==(const std::discrete_distribution<_IntType>& __d1,
+	       const std::discrete_distribution<_IntType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+    * @brief Return true if two discrete distributions have different
+    *        parameters.
+    */
+  template<typename _IntType>
+    inline bool
+    operator!=(const std::discrete_distribution<_IntType>& __d1,
+	       const std::discrete_distribution<_IntType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A piecewise_constant_distribution random number distribution.
+   *
+   * The formula for the piecewise constant probability mass function is
+   *
+   */
+  template<typename _RealType = double>
+    class piecewise_constant_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef piecewise_constant_distribution<_RealType> distribution_type;
+	friend class piecewise_constant_distribution<_RealType>;
+
+	param_type()
+	: _M_int(), _M_den(), _M_cp()
+	{ }
+
+	template<typename _InputIteratorB, typename _InputIteratorW>
+	  param_type(_InputIteratorB __bfirst,
+		     _InputIteratorB __bend,
+		     _InputIteratorW __wbegin);
+
+	template<typename _Func>
+	  param_type(initializer_list<_RealType> __bi, _Func __fw);
+
+	template<typename _Func>
+	  param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
+		     _Func __fw);
+
+	// See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/
+	param_type(const param_type&) = default;
+	param_type& operator=(const param_type&) = default;
+
+	std::vector<_RealType>
+	intervals() const
+	{
+	  if (_M_int.empty())
+	    {
+	      std::vector<_RealType> __tmp(2);
+	      __tmp[1] = _RealType(1);
+	      return __tmp;
+	    }
+	  else
+	    return _M_int;
+	}
+
+	std::vector<double>
+	densities() const
+	{ return _M_den.empty() ? std::vector<double>(1, 1.0) : _M_den; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
+
+      private:
+	void
+	_M_initialize();
+
+	std::vector<_RealType> _M_int;
+	std::vector<double> _M_den;
+	std::vector<double> _M_cp;
+      };
+
+      explicit
+      piecewise_constant_distribution()
+      : _M_param()
+      { }
+
+      template<typename _InputIteratorB, typename _InputIteratorW>
+	piecewise_constant_distribution(_InputIteratorB __bfirst,
+					_InputIteratorB __bend,
+					_InputIteratorW __wbegin)
+	: _M_param(__bfirst, __bend, __wbegin)
+	{ }
+
+      template<typename _Func>
+	piecewise_constant_distribution(initializer_list<_RealType> __bl,
+					_Func __fw)
+	: _M_param(__bl, __fw)
+	{ }
+
+      template<typename _Func>
+	piecewise_constant_distribution(size_t __nw,
+					_RealType __xmin, _RealType __xmax,
+					_Func __fw)
+	: _M_param(__nw, __xmin, __xmax, __fw)
+	{ }
+
+      explicit
+      piecewise_constant_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * @brief Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Returns a vector of the intervals.
+       */
+      std::vector<_RealType>
+      intervals() const
+      {
+	if (_M_param._M_int.empty())
+	  {
+	    std::vector<_RealType> __tmp(2);
+	    __tmp[1] = _RealType(1);
+	    return __tmp;
+	  }
+	else
+	  return _M_param._M_int;
+      }
+
+      /**
+       * @brief Returns a vector of the probability densities.
+       */
+      std::vector<double>
+      densities() const
+      {
+	return _M_param._M_den.empty()
+	  ? std::vector<double>(1, 1.0) : _M_param._M_den;
+      }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      {
+	return _M_param._M_int.empty()
+	  ? result_type(0) : _M_param._M_int.front();
+      }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      {
+	return _M_param._M_int.empty()
+	  ? result_type(1) : _M_param._M_int.back();
+      }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Inserts a %piecewise_constan_distribution random
+       *        number distribution @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %piecewise_constan_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>&,
+		   const std::piecewise_constant_distribution<_RealType1>&);
+
+      /**
+       * @brief Extracts a %piecewise_constan_distribution random
+       *        number distribution @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x A %piecewise_constan_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>&,
+		   std::piecewise_constant_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+    * @brief Return true if two piecewise constant distributions have the
+    *        same parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator==(const std::piecewise_constant_distribution<_RealType>& __d1,
+	       const std::piecewise_constant_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+    * @brief Return true if two piecewise constant distributions have 
+    *        different parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::piecewise_constant_distribution<_RealType>& __d1,
+	       const std::piecewise_constant_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /**
+   * @brief A piecewise_linear_distribution random number distribution.
+   *
+   * The formula for the piecewise linear probability mass function is
+   *
+   */
+  template<typename _RealType = double>
+    class piecewise_linear_distribution
+    {
+      static_assert(std::is_floating_point<_RealType>::value,
+		    "template argument not a floating point type");
+
+    public:
+      /** The type of the range of the distribution. */
+      typedef _RealType result_type;
+      /** Parameter type. */
+      struct param_type
+      {
+	typedef piecewise_linear_distribution<_RealType> distribution_type;
+	friend class piecewise_linear_distribution<_RealType>;
+
+	param_type()
+	: _M_int(), _M_den(), _M_cp(), _M_m()
+	{ }
+
+	template<typename _InputIteratorB, typename _InputIteratorW>
+	  param_type(_InputIteratorB __bfirst,
+		     _InputIteratorB __bend,
+		     _InputIteratorW __wbegin);
+
+	template<typename _Func>
+	  param_type(initializer_list<_RealType> __bl, _Func __fw);
+
+	template<typename _Func>
+	  param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
+		     _Func __fw);
+
+	// See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/
+	param_type(const param_type&) = default;
+	param_type& operator=(const param_type&) = default;
+
+	std::vector<_RealType>
+	intervals() const
+	{
+	  if (_M_int.empty())
+	    {
+	      std::vector<_RealType> __tmp(2);
+	      __tmp[1] = _RealType(1);
+	      return __tmp;
+	    }
+	  else
+	    return _M_int;
+	}
+
+	std::vector<double>
+	densities() const
+	{ return _M_den.empty() ? std::vector<double>(2, 1.0) : _M_den; }
+
+	friend bool
+	operator==(const param_type& __p1, const param_type& __p2)
+	{ return (__p1._M_int == __p2._M_int
+		  && __p1._M_den == __p2._M_den); }
+
+      private:
+	void
+	_M_initialize();
+
+	std::vector<_RealType> _M_int;
+	std::vector<double> _M_den;
+	std::vector<double> _M_cp;
+	std::vector<double> _M_m;
+      };
+
+      explicit
+      piecewise_linear_distribution()
+      : _M_param()
+      { }
+
+      template<typename _InputIteratorB, typename _InputIteratorW>
+	piecewise_linear_distribution(_InputIteratorB __bfirst,
+				      _InputIteratorB __bend,
+				      _InputIteratorW __wbegin)
+	: _M_param(__bfirst, __bend, __wbegin)
+	{ }
+
+      template<typename _Func>
+	piecewise_linear_distribution(initializer_list<_RealType> __bl,
+				      _Func __fw)
+	: _M_param(__bl, __fw)
+	{ }
+
+      template<typename _Func>
+	piecewise_linear_distribution(size_t __nw,
+				      _RealType __xmin, _RealType __xmax,
+				      _Func __fw)
+	: _M_param(__nw, __xmin, __xmax, __fw)
+	{ }
+
+      explicit
+      piecewise_linear_distribution(const param_type& __p)
+      : _M_param(__p)
+      { }
+
+      /**
+       * Resets the distribution state.
+       */
+      void
+      reset()
+      { }
+
+      /**
+       * @brief Return the intervals of the distribution.
+       */
+      std::vector<_RealType>
+      intervals() const
+      {
+	if (_M_param._M_int.empty())
+	  {
+	    std::vector<_RealType> __tmp(2);
+	    __tmp[1] = _RealType(1);
+	    return __tmp;
+	  }
+	else
+	  return _M_param._M_int;
+      }
+
+      /**
+       * @brief Return a vector of the probability densities of the
+       *        distribution.
+       */
+      std::vector<double>
+      densities() const
+      {
+	return _M_param._M_den.empty()
+	  ? std::vector<double>(2, 1.0) : _M_param._M_den;
+      }
+
+      /**
+       * @brief Returns the parameter set of the distribution.
+       */
+      param_type
+      param() const
+      { return _M_param; }
+
+      /**
+       * @brief Sets the parameter set of the distribution.
+       * @param __param The new parameter set of the distribution.
+       */
+      void
+      param(const param_type& __param)
+      { _M_param = __param; }
+
+      /**
+       * @brief Returns the greatest lower bound value of the distribution.
+       */
+      result_type
+      min() const
+      {
+	return _M_param._M_int.empty()
+	  ? result_type(0) : _M_param._M_int.front();
+      }
+
+      /**
+       * @brief Returns the least upper bound value of the distribution.
+       */
+      result_type
+      max() const
+      {
+	return _M_param._M_int.empty()
+	  ? result_type(1) : _M_param._M_int.back();
+      }
+
+      /**
+       * @brief Generating functions.
+       */
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng)
+	{ return this->operator()(__urng, this->param()); }
+
+      template<typename _UniformRandomNumberGenerator>
+	result_type
+	operator()(_UniformRandomNumberGenerator& __urng,
+		   const param_type& __p);
+
+      /**
+       * @brief Inserts a %piecewise_linear_distribution random number
+       *        distribution @p __x into the output stream @p __os.
+       *
+       * @param __os An output stream.
+       * @param __x  A %piecewise_linear_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>&,
+		   const std::piecewise_linear_distribution<_RealType1>&);
+
+      /**
+       * @brief Extracts a %piecewise_linear_distribution random number
+       *        distribution @p __x from the input stream @p __is.
+       *
+       * @param __is An input stream.
+       * @param __x  A %piecewise_linear_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>&,
+		   std::piecewise_linear_distribution<_RealType1>&);
+
+    private:
+      param_type _M_param;
+    };
+
+  /**
+    * @brief Return true if two piecewise linear distributions have the
+    *        same parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator==(const std::piecewise_linear_distribution<_RealType>& __d1,
+	       const std::piecewise_linear_distribution<_RealType>& __d2)
+    { return __d1.param() == __d2.param(); }
+
+  /**
+    * @brief Return true if two piecewise linear distributions have
+    *        different parameters.
+   */
+  template<typename _RealType>
+    inline bool
+    operator!=(const std::piecewise_linear_distribution<_RealType>& __d1,
+	       const std::piecewise_linear_distribution<_RealType>& __d2)
+    { return !(__d1 == __d2); }
+
+
+  /* @} */ // group random_distributions_poisson
+
+  /* @} */ // group random_distributions
+
+  /**
+   * @addtogroup random_utilities Random Number Utilities
+   * @ingroup random
+   * @{
+   */
+
+  /**
+   * @brief The seed_seq class generates sequences of seeds for random
+   *        number generators.
+   */
+  class seed_seq
+  {
+
+  public:
+    /** The type of the seed vales. */
+    typedef uint_least32_t result_type;
+
+    /** Default constructor. */
+    seed_seq()
+    : _M_v()
+    { }
+
+    template<typename _IntType>
+      seed_seq(std::initializer_list<_IntType> il);
+
+    template<typename _InputIterator>
+      seed_seq(_InputIterator __begin, _InputIterator __end);
+
+    // generating functions
+    template<typename _RandomAccessIterator>
+      void
+      generate(_RandomAccessIterator __begin, _RandomAccessIterator __end);
+
+    // property functions
+    size_t size() const
+    { return _M_v.size(); }
+
+    template<typename OutputIterator>
+      void
+      param(OutputIterator __dest) const
+      { std::copy(_M_v.begin(), _M_v.end(), __dest); }
+
+  private:
+    ///
+    std::vector<result_type> _M_v;
+  };
+
+  /* @} */ // group random_utilities
+
+  /* @} */ // group random
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.tcc
new file mode 100644
index 0000000..b9f6af6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.tcc
@@ -0,0 +1,2830 @@
+// random number generation (out of line) -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/random.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{random}
+ */
+
+#ifndef _RANDOM_TCC
+#define _RANDOM_TCC 1
+
+#include <numeric> // std::accumulate and std::partial_sum
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  /*
+   * (Further) implementation-space details.
+   */
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    // 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 __m, _Tp __a, _Tp __c, 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 __m, _Tp __a, _Tp __c>
+      struct _Mod<_Tp, __m, __a, __c, true>
+      {
+	static _Tp
+	__calc(_Tp __x)
+	{ return __a * __x + __c; }
+      };
+
+    template<typename _InputIterator, typename _OutputIterator,
+	     typename _UnaryOperation>
+      _OutputIterator
+      __transform(_InputIterator __first, _InputIterator __last,
+		  _OutputIterator __result, _UnaryOperation __unary_op)
+      {
+	for (; __first != __last; ++__first, ++__result)
+	  *__result = __unary_op(*__first);
+	return __result;
+      }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace __detail
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    constexpr _UIntType
+    linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
+
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    constexpr _UIntType
+    linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
+
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    constexpr _UIntType
+    linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
+
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    constexpr _UIntType
+    linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
+
+  /**
+   * Seeds the LCR with integral value @p __s, adjusted so that the
+   * ring identity is never a member of the convergence set.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    void
+    linear_congruential_engine<_UIntType, __a, __c, __m>::
+    seed(result_type __s)
+    {
+      if ((__detail::__mod<_UIntType, __m>(__c) == 0)
+	  && (__detail::__mod<_UIntType, __m>(__s) == 0))
+	_M_x = 1;
+      else
+	_M_x = __detail::__mod<_UIntType, __m>(__s);
+    }
+
+  /**
+   * Seeds the LCR engine with a value generated by @p __q.
+   */
+  template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    template<typename _Sseq>
+      typename std::enable_if<std::is_class<_Sseq>::value>::type
+      linear_congruential_engine<_UIntType, __a, __c, __m>::
+      seed(_Sseq& __q)
+      {
+	const _UIntType __k0 = __m == 0 ? std::numeric_limits<_UIntType>::digits
+	                                : std::__lg(__m);
+	const _UIntType __k = (__k0 + 31) / 32;
+	uint_least32_t __arr[__k + 3];
+	__q.generate(__arr + 0, __arr + __k + 3);
+	_UIntType __factor = 1u;
+	_UIntType __sum = 0u;
+	for (size_t __j = 0; __j < __k; ++__j)
+	  {
+	    __sum += __arr[__j + 3] * __factor;
+	    __factor *= __detail::_Shift<_UIntType, 32>::__value;
+	  }
+	seed(__sum);
+      }
+
+  template<typename _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_engine<_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<typename _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_engine<_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<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::word_size;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::state_size;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::shift_size;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::mask_bits;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr _UIntType
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::xor_mask;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_u;
+   
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr _UIntType
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_d;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_s;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr _UIntType
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_b;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_t;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr _UIntType
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_c;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr size_t
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::tempering_l;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr _UIntType
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::
+                                              initialization_multiplier;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    constexpr _UIntType
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::default_seed;
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    void
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::
+    seed(result_type __sd)
+    {
+      _M_x[0] = __detail::__mod<_UIntType,
+	__detail::_Shift<_UIntType, __w>::__value>(__sd);
+
+      for (size_t __i = 1; __i < state_size; ++__i)
+	{
+	  _UIntType __x = _M_x[__i - 1];
+	  __x ^= __x >> (__w - 2);
+	  __x *= __f;
+	  __x += __detail::__mod<_UIntType, __n>(__i);
+	  _M_x[__i] = __detail::__mod<_UIntType,
+	    __detail::_Shift<_UIntType, __w>::__value>(__x);
+	}
+      _M_p = state_size;
+    }
+
+  template<typename _UIntType,
+	   size_t __w, size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    template<typename _Sseq>
+      typename std::enable_if<std::is_class<_Sseq>::value>::type
+      mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			      __s, __b, __t, __c, __l, __f>::
+      seed(_Sseq& __q)
+      {
+	const _UIntType __upper_mask = (~_UIntType()) << __r;
+	const size_t __k = (__w + 31) / 32;
+	uint_least32_t __arr[__n * __k];
+	__q.generate(__arr + 0, __arr + __n * __k);
+
+	bool __zero = true;
+	for (size_t __i = 0; __i < state_size; ++__i)
+	  {
+	    _UIntType __factor = 1u;
+	    _UIntType __sum = 0u;
+	    for (size_t __j = 0; __j < __k; ++__j)
+	      {
+		__sum += __arr[__k * __i + __j] * __factor;
+		__factor *= __detail::_Shift<_UIntType, 32>::__value;
+	      }
+	    _M_x[__i] = __detail::__mod<_UIntType,
+	      __detail::_Shift<_UIntType, __w>::__value>(__sum);
+
+	    if (__zero)
+	      {
+		if (__i == 0)
+		  {
+		    if ((_M_x[0] & __upper_mask) != 0u)
+		      __zero = false;
+		  }
+		else if (_M_x[__i] != 0u)
+		  __zero = false;
+	      }
+	  }
+        if (__zero)
+          _M_x[0] = __detail::_Shift<_UIntType, __w - 1>::__value;
+      }
+
+  template<typename _UIntType, size_t __w,
+	   size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f>
+    typename
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::result_type
+    mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
+			    __s, __b, __t, __c, __l, __f>::
+    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 (size_t __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 (size_t __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) & __d;
+      __z ^= (__z << __s) & __b;
+      __z ^= (__z << __t) & __c;
+      __z ^= (__z >> __l);
+
+      return __z;
+    }
+
+  template<typename _UIntType, size_t __w,
+	   size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const mersenne_twister_engine<_UIntType, __w, __n, __m,
+	       __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __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 (size_t __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<typename _UIntType, size_t __w,
+	   size_t __n, size_t __m, size_t __r,
+	   _UIntType __a, size_t __u, _UIntType __d, size_t __s,
+	   _UIntType __b, size_t __t, _UIntType __c, size_t __l,
+	   _UIntType __f, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       mersenne_twister_engine<_UIntType, __w, __n, __m,
+	       __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __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 (size_t __i = 0; __i < __n; ++__i)
+	__is >> __x._M_x[__i];
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    constexpr size_t
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    constexpr size_t
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    constexpr size_t
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    constexpr _UIntType
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    void
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+    seed(result_type __value)
+    {
+      std::linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
+	__lcg(__value == 0u ? default_seed : __value);
+
+      const size_t __n = (__w + 31) / 32;
+
+      for (size_t __i = 0; __i < long_lag; ++__i)
+	{
+	  _UIntType __sum = 0u;
+	  _UIntType __factor = 1u;
+	  for (size_t __j = 0; __j < __n; ++__j)
+	    {
+	      __sum += __detail::__mod<uint_least32_t,
+		       __detail::_Shift<uint_least32_t, 32>::__value>
+			 (__lcg()) * __factor;
+	      __factor *= __detail::_Shift<_UIntType, 32>::__value;
+	    }
+	  _M_x[__i] = __detail::__mod<_UIntType,
+	    __detail::_Shift<_UIntType, __w>::__value>(__sum);
+	}
+      _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
+      _M_p = 0;
+    }
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    template<typename _Sseq>
+      typename std::enable_if<std::is_class<_Sseq>::value>::type
+      subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+      seed(_Sseq& __q)
+      {
+	const size_t __k = (__w + 31) / 32;
+	uint_least32_t __arr[__r * __k];
+	__q.generate(__arr + 0, __arr + __r * __k);
+
+	for (size_t __i = 0; __i < long_lag; ++__i)
+	  {
+	    _UIntType __sum = 0u;
+	    _UIntType __factor = 1u;
+	    for (size_t __j = 0; __j < __k; ++__j)
+	      {
+		__sum += __arr[__k * __i + __j] * __factor;
+		__factor *= __detail::_Shift<_UIntType, 32>::__value;
+	      }
+	    _M_x[__i] = __detail::__mod<_UIntType,
+	      __detail::_Shift<_UIntType, __w>::__value>(__sum);
+	  }
+	_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
+	_M_p = 0;
+      }
+
+  template<typename _UIntType, size_t __w, size_t __s, size_t __r>
+    typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+	     result_type
+    subtract_with_carry_engine<_UIntType, __w, __s, __r>::
+    operator()()
+    {
+      // Derive short lag index from current index.
+      long __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 _UIntType, _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 = (__detail::_Shift<_UIntType, __w>::__value
+		  - _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 _UIntType, size_t __w, size_t __s, size_t __r,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const subtract_with_carry_engine<_UIntType,
+						__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 (size_t __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 _UIntType, size_t __w, size_t __s, size_t __r,
+	   typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       subtract_with_carry_engine<_UIntType, __w, __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 (size_t __i = 0; __i < __r; ++__i)
+	__is >> __x._M_x[__i];
+      __is >> __x._M_carry;
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    constexpr size_t
+    discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    constexpr size_t
+    discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r>
+    typename discard_block_engine<_RandomNumberEngine,
+			   __p, __r>::result_type
+    discard_block_engine<_RandomNumberEngine, __p, __r>::
+    operator()()
+    {
+      if (_M_n >= used_block)
+	{
+	  _M_b.discard(block_size - _M_n);
+	  _M_n = 0;
+	}
+      ++_M_n;
+      return _M_b();
+    }
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const discard_block_engine<_RandomNumberEngine,
+	       __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.base() << __space << __x._M_n;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _RandomNumberEngine, size_t __p, size_t __r,
+	   typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       discard_block_engine<_RandomNumberEngine, __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<typename _RandomNumberEngine, size_t __w, typename _UIntType>
+    typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
+      result_type
+    independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
+    operator()()
+    {
+      const long double __r = static_cast<long double>(_M_b.max())
+			    - static_cast<long double>(_M_b.min()) + 1.0L;
+      const result_type __m = std::log(__r) / std::log(2.0L);
+      result_type __n, __n0, __y0, __y1, __s0, __s1;
+      for (size_t __i = 0; __i < 2; ++__i)
+	{
+	  __n = (__w + __m - 1) / __m + __i;
+	  __n0 = __n - __w % __n;
+	  const result_type __w0 = __w / __n;
+	  const result_type __w1 = __w0 + 1;
+	  __s0 = result_type(1) << __w0;
+	  __s1 = result_type(1) << __w1;
+	  __y0 = __s0 * (__r / __s0);
+	  __y1 = __s1 * (__r / __s1);
+	  if (__r - __y0 <= __y0 / __n)
+	    break;
+	}
+
+      result_type __sum = 0;
+      for (size_t __k = 0; __k < __n0; ++__k)
+	{
+	  result_type __u;
+	  do
+	    __u = _M_b() - _M_b.min();
+	  while (__u >= __y0);
+	  __sum = __s0 * __sum + __u % __s0;
+	}
+      for (size_t __k = __n0; __k < __n; ++__k)
+	{
+	  result_type __u;
+	  do
+	    __u = _M_b() - _M_b.min();
+	  while (__u >= __y1);
+	  __sum = __s1 * __sum + __u % __s1;
+	}
+      return __sum;
+    }
+
+
+  template<typename _RandomNumberEngine, size_t __k>
+    constexpr size_t
+    shuffle_order_engine<_RandomNumberEngine, __k>::table_size;
+
+  template<typename _RandomNumberEngine, size_t __k>
+    typename shuffle_order_engine<_RandomNumberEngine, __k>::result_type
+    shuffle_order_engine<_RandomNumberEngine, __k>::
+    operator()()
+    {
+      size_t __j = __k * ((_M_y - _M_b.min())
+			  / (_M_b.max() - _M_b.min() + 1.0L));
+      _M_y = _M_v[__j];
+      _M_v[__j] = _M_b();
+
+      return _M_y;
+    }
+
+  template<typename _RandomNumberEngine, size_t __k,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const shuffle_order_engine<_RandomNumberEngine, __k>& __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.base();
+      for (size_t __i = 0; __i < __k; ++__i)
+	__os << __space << __x._M_v[__i];
+      __os << __space << __x._M_y;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      return __os;
+    }
+
+  template<typename _RandomNumberEngine, size_t __k,
+	   typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       shuffle_order_engine<_RandomNumberEngine, __k>& __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;
+      for (size_t __i = 0; __i < __k; ++__i)
+	__is >> __x._M_v[__i];
+      __is >> __x._M_y;
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename uniform_int_distribution<_IntType>::result_type
+      uniform_int_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	typedef typename std::make_unsigned<typename
+	  _UniformRandomNumberGenerator::result_type>::type __urngtype;
+	typedef typename std::make_unsigned<result_type>::type __utype;
+	typedef typename std::conditional<(sizeof(__urngtype)
+					   > sizeof(__utype)),
+	  __urngtype, __utype>::type __uctype;
+
+	const __uctype __urngmin = __urng.min();
+	const __uctype __urngmax = __urng.max();
+	const __uctype __urngrange = __urngmax - __urngmin;
+	const __uctype __urange
+	  = __uctype(__param.b()) - __uctype(__param.a());
+
+	__uctype __ret;
+
+	if (__urngrange > __urange)
+	  {
+	    // downscaling
+	    const __uctype __uerange = __urange + 1; // __urange can be zero
+	    const __uctype __scaling = __urngrange / __uerange;
+	    const __uctype __past = __uerange * __scaling;
+	    do
+	      __ret = __uctype(__urng()) - __urngmin;
+	    while (__ret >= __past);
+	    __ret /= __scaling;
+	  }
+	else if (__urngrange < __urange)
+	  {
+	    // upscaling
+	    /*
+	      Note that every value in [0, urange]
+	      can be written uniquely as
+
+	      (urngrange + 1) * high + low
+
+	      where
+
+	      high in [0, urange / (urngrange + 1)]
+
+	      and
+	
+	      low in [0, urngrange].
+	    */
+	    __uctype __tmp; // wraparound control
+	    do
+	      {
+		const __uctype __uerngrange = __urngrange + 1;
+		__tmp = (__uerngrange * operator()
+			 (__urng, param_type(0, __urange / __uerngrange)));
+		__ret = __tmp + (__uctype(__urng()) - __urngmin);
+	      }
+	    while (__ret > __urange || __ret < __tmp);
+	  }
+	else
+	  __ret = __uctype(__urng()) - __urngmin;
+
+	return __ret + __param.a();
+      }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const uniform_int_distribution<_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.a() << __space << __x.b();
+
+      __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_distribution<_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);
+
+      _IntType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename uniform_int_distribution<_IntType>::
+		param_type(__a, __b));
+
+      __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_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.a() << __space << __x.b();
+
+      __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_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::skipws);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename uniform_real_distribution<_RealType>::
+		param_type(__a, __b));
+
+      __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(std::numeric_limits<double>::max_digits10);
+
+      __os << __x.p();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename geometric_distribution<_IntType>::result_type
+      geometric_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	// About the epsilon thing see this thread:
+	// http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html
+	const double __naf =
+	  (1 - std::numeric_limits<double>::epsilon()) / 2;
+	// The largest _RealType convertible to _IntType.
+	const double __thr =
+	  std::numeric_limits<_IntType>::max() + __naf;
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+
+	double __cand;
+	do
+	  __cand = std::floor(std::log(__aurng()) / __param._M_log_1_p);
+	while (__cand >= __thr);
+
+	return result_type(__cand + __naf);
+      }
+
+  template<typename _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const geometric_distribution<_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 std::streamsize __precision = __os.precision();
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__os.widen(' '));
+      __os.precision(std::numeric_limits<double>::max_digits10);
+
+      __os << __x.p();
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       geometric_distribution<_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::skipws);
+
+      double __p;
+      __is >> __p;
+      __x.param(typename geometric_distribution<_IntType>::param_type(__p));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename negative_binomial_distribution<_IntType>::result_type
+      negative_binomial_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng)
+      {
+	const double __y = _M_gd(__urng);
+
+	// XXX Is the constructor too slow?
+	std::poisson_distribution<result_type> __poisson(__y);
+	return __poisson(__urng);
+      }
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename negative_binomial_distribution<_IntType>::result_type
+      negative_binomial_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __p)
+      {
+	typedef typename std::gamma_distribution<result_type>::param_type
+	  param_type;
+	
+	const double __y =
+	  _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
+
+	std::poisson_distribution<result_type> __poisson(__y);
+	return __poisson(__urng);
+      }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const negative_binomial_distribution<_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 std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__os.widen(' '));
+      __os.precision(std::numeric_limits<double>::max_digits10);
+
+      __os << __x.k() << __space << __x.p()
+	   << __space << __x._M_gd;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       negative_binomial_distribution<_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::skipws);
+
+      _IntType __k;
+      double __p;
+      __is >> __k >> __p >> __x._M_gd;
+      __x.param(typename negative_binomial_distribution<_IntType>::
+		param_type(__k, __p));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    void
+    poisson_distribution<_IntType>::param_type::
+    _M_initialize()
+    {
+#if _GLIBCXX_USE_C99_MATH_TR1
+      if (_M_mean >= 12)
+	{
+	  const double __m = std::floor(_M_mean);
+	  _M_lm_thr = std::log(_M_mean);
+	  _M_lfm = std::lgamma(__m + 1);
+	  _M_sm = std::sqrt(__m);
+
+	  const double __pi_4 = 0.7853981633974483096156608458198757L;
+	  const double __dx = std::sqrt(2 * __m * std::log(32 * __m
+							      / __pi_4));
+	  _M_d = std::round(std::max(6.0, std::min(__m, __dx)));
+	  const double __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>
+    template<typename _UniformRandomNumberGenerator>
+      typename poisson_distribution<_IntType>::result_type
+      poisson_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+#if _GLIBCXX_USE_C99_MATH_TR1
+	if (__param.mean() >= 12)
+	  {
+	    double __x;
+
+	    // See comments above...
+	    const double __naf =
+	      (1 - std::numeric_limits<double>::epsilon()) / 2;
+	    const double __thr =
+	      std::numeric_limits<_IntType>::max() + __naf;
+
+	    const double __m = std::floor(__param.mean());
+	    // sqrt(pi / 2)
+	    const double __spi_2 = 1.2533141373155002512078826424055226L;
+	    const double __c1 = __param._M_sm * __spi_2;
+	    const double __c2 = __param._M_c2b + __c1;
+	    const double __c3 = __c2 + 1;
+	    const double __c4 = __c3 + 1;
+	    // e^(1 / 78)
+	    const double __e178 = 1.0129030479320018583185514777512983L;
+	    const double __c5 = __c4 + __e178;
+	    const double __c = __param._M_cb + __c5;
+	    const double __2cx = 2 * (2 * __m + __param._M_d);
+
+	    bool __reject = true;
+	    do
+	      {
+		const double __u = __c * __aurng();
+		const double __e = -std::log(__aurng());
+
+		double __w = 0.0;
+
+		if (__u <= __c1)
+		  {
+		    const double __n = _M_nd(__urng);
+		    const double __y = -std::abs(__n) * __param._M_sm - 1;
+		    __x = std::floor(__y);
+		    __w = -__n * __n / 2;
+		    if (__x < -__m)
+		      continue;
+		  }
+		else if (__u <= __c2)
+		  {
+		    const double __n = _M_nd(__urng);
+		    const double __y = 1 + std::abs(__n) * __param._M_scx;
+		    __x = std::ceil(__y);
+		    __w = __y * (2 - __y) * __param._M_1cx;
+		    if (__x > __param._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 double __v = -std::log(__aurng());
+		    const double __y = __param._M_d
+				     + __v * __2cx / __param._M_d;
+		    __x = std::ceil(__y);
+		    __w = -__param._M_d * __param._M_1cx * (1 + __y / 2);
+		  }
+
+		__reject = (__w - __e - __x * __param._M_lm_thr
+			    > __param._M_lfm - std::lgamma(__x + __m + 1));
+
+		__reject |= __x + __m >= __thr;
+
+	      } while (__reject);
+
+	    return result_type(__x + __m + __naf);
+	  }
+	else
+#endif
+	  {
+	    _IntType     __x = 0;
+	    double __prod = 1.0;
+
+	    do
+	      {
+		__prod *= __aurng();
+		__x += 1;
+	      }
+	    while (__prod > __param._M_lm_thr);
+
+	    return __x - 1;
+	  }
+      }
+
+  template<typename _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const poisson_distribution<_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 std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<double>::max_digits10);
+
+      __os << __x.mean() << __space << __x._M_nd;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       poisson_distribution<_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::skipws);
+
+      double __mean;
+      __is >> __mean >> __x._M_nd;
+      __x.param(typename poisson_distribution<_IntType>::param_type(__mean));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    void
+    binomial_distribution<_IntType>::param_type::
+    _M_initialize()
+    {
+      const double __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 double __np = std::floor(_M_t * __p12);
+	  const double __pa = __np / _M_t;
+	  const double __1p = 1 - __pa;
+
+	  const double __pi_4 = 0.7853981633974483096156608458198757L;
+	  const double __d1x =
+	    std::sqrt(__np * __1p * std::log(32 * __np
+					     / (81 * __pi_4 * __1p)));
+	  _M_d1 = std::round(std::max(1.0, __d1x));
+	  const double __d2x =
+	    std::sqrt(__np * __1p * std::log(32 * _M_t * __1p
+					     / (__pi_4 * __pa)));
+	  _M_d2 = std::round(std::max(1.0, __d2x));
+
+	  // sqrt(pi / 2)
+	  const double __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 double __a12 = _M_a1 + _M_s2 * __spi_2;
+	  const double __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 double __s2s = _M_s2 * _M_s2;
+	  _M_s = (_M_a123 + 2 * __s2s / _M_d2
+		  * std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
+	  _M_lf = (std::lgamma(__np + 1)
+		   + std::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>
+    template<typename _UniformRandomNumberGenerator>
+      typename binomial_distribution<_IntType>::result_type
+      binomial_distribution<_IntType>::
+      _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)
+      {
+	_IntType __x = 0;
+	double __sum = 0.0;
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+
+	do
+	  {
+	    const double __e = -std::log(__aurng());
+	    __sum += __e / (__t - __x);
+	    __x += 1;
+	  }
+	while (__sum <= _M_param._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>
+    template<typename _UniformRandomNumberGenerator>
+      typename binomial_distribution<_IntType>::result_type
+      binomial_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	result_type __ret;
+	const _IntType __t = __param.t();
+	const double __p = __param.p();
+	const double __p12 = __p <= 0.5 ? __p : 1.0 - __p;
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+	if (!__param._M_easy)
+	  {
+	    double __x;
+
+	    // See comments above...
+	    const double __naf =
+	      (1 - std::numeric_limits<double>::epsilon()) / 2;
+	    const double __thr =
+	      std::numeric_limits<_IntType>::max() + __naf;
+
+	    const double __np = std::floor(__t * __p12);
+
+	    // sqrt(pi / 2)
+	    const double __spi_2 = 1.2533141373155002512078826424055226L;
+	    const double __a1 = __param._M_a1;
+	    const double __a12 = __a1 + __param._M_s2 * __spi_2;
+	    const double __a123 = __param._M_a123;
+	    const double __s1s = __param._M_s1 * __param._M_s1;
+	    const double __s2s = __param._M_s2 * __param._M_s2;
+
+	    bool __reject;
+	    do
+	      {
+		const double __u = __param._M_s * __aurng();
+
+		double __v;
+
+		if (__u <= __a1)
+		  {
+		    const double __n = _M_nd(__urng);
+		    const double __y = __param._M_s1 * std::abs(__n);
+		    __reject = __y >= __param._M_d1;
+		    if (!__reject)
+		      {
+			const double __e = -std::log(__aurng());
+			__x = std::floor(__y);
+			__v = -__e - __n * __n / 2 + __param._M_c;
+		      }
+		  }
+		else if (__u <= __a12)
+		  {
+		    const double __n = _M_nd(__urng);
+		    const double __y = __param._M_s2 * std::abs(__n);
+		    __reject = __y >= __param._M_d2;
+		    if (!__reject)
+		      {
+			const double __e = -std::log(__aurng());
+			__x = std::floor(-__y);
+			__v = -__e - __n * __n / 2;
+		      }
+		  }
+		else if (__u <= __a123)
+		  {
+		    const double __e1 = -std::log(__aurng());
+		    const double __e2 = -std::log(__aurng());
+
+		    const double __y = __param._M_d1
+				     + 2 * __s1s * __e1 / __param._M_d1;
+		    __x = std::floor(__y);
+		    __v = (-__e2 + __param._M_d1 * (1 / (__t - __np)
+						    -__y / (2 * __s1s)));
+		    __reject = false;
+		  }
+		else
+		  {
+		    const double __e1 = -std::log(__aurng());
+		    const double __e2 = -std::log(__aurng());
+
+		    const double __y = __param._M_d2
+				     + 2 * __s2s * __e1 / __param._M_d2;
+		    __x = std::floor(-__y);
+		    __v = -__e2 - __param._M_d2 * __y / (2 * __s2s);
+		    __reject = false;
+		  }
+
+		__reject = __reject || __x < -__np || __x > __t - __np;
+		if (!__reject)
+		  {
+		    const double __lfx =
+		      std::lgamma(__np + __x + 1)
+		      + std::lgamma(__t - (__np + __x) + 1);
+		    __reject = __v > __param._M_lf - __lfx
+			     + __x * __param._M_lp1p;
+		  }
+
+		__reject |= __x + __np >= __thr;
+	      }
+	    while (__reject);
+
+	    __x += __np + __naf;
+
+	    const _IntType __z = _M_waiting(__urng, __t - _IntType(__x));
+	    __ret = _IntType(__x) + __z;
+	  }
+	else
+#endif
+	  __ret = _M_waiting(__urng, __t);
+
+	if (__p12 != __p)
+	  __ret = __t - __ret;
+	return __ret;
+      }
+
+  template<typename _IntType,
+	   typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const binomial_distribution<_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 std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<double>::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 _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       binomial_distribution<_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);
+
+      _IntType __t;
+      double __p;
+      __is >> __t >> __p >> __x._M_nd;
+      __x.param(typename binomial_distribution<_IntType>::
+		param_type(__t, __p));
+
+      __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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.lambda();
+
+      __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,
+	       exponential_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);
+
+      _RealType __lambda;
+      __is >> __lambda;
+      __x.param(typename exponential_distribution<_RealType>::
+		param_type(__lambda));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  /**
+   * 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<typename _UniformRandomNumberGenerator>
+      typename normal_distribution<_RealType>::result_type
+      normal_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	result_type __ret;
+	__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	  __aurng(__urng);
+
+	if (_M_saved_available)
+	  {
+	    _M_saved_available = false;
+	    __ret = _M_saved;
+	  }
+	else
+	  {
+	    result_type __x, __y, __r2;
+	    do
+	      {
+		__x = result_type(2.0) * __aurng() - 1.0;
+		__y = result_type(2.0) * __aurng() - 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 * __param.stddev() + __param.mean();
+	return __ret;
+      }
+
+  template<typename _RealType>
+    bool
+    operator==(const std::normal_distribution<_RealType>& __d1,
+	       const std::normal_distribution<_RealType>& __d2)
+    {
+      if (__d1._M_param == __d2._M_param
+	  && __d1._M_saved_available == __d2._M_saved_available)
+	{
+	  if (__d1._M_saved_available
+	      && __d1._M_saved == __d2._M_saved)
+	    return true;
+	  else if(!__d1._M_saved_available)
+	    return true;
+	  else
+	    return false;
+	}
+      else
+	return false;
+    }
+
+  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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.mean() << __space << __x.stddev()
+	   << __space << __x._M_saved_available;
+      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);
+
+      double __mean, __stddev;
+      __is >> __mean >> __stddev
+	   >> __x._M_saved_available;
+      if (__x._M_saved_available)
+	__is >> __x._M_saved;
+      __x.param(typename normal_distribution<_RealType>::
+		param_type(__mean, __stddev));
+
+      __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 lognormal_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.m() << __space << __x.s()
+	   << __space << __x._M_nd;
+
+      __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,
+	       lognormal_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);
+
+      _RealType __m, __s;
+      __is >> __m >> __s >> __x._M_nd;
+      __x.param(typename lognormal_distribution<_RealType>::
+		param_type(__m, __s));
+
+      __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 chi_squared_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.n() << __space << __x._M_gd;
+
+      __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,
+	       chi_squared_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);
+
+      _RealType __n;
+      __is >> __n >> __x._M_gd;
+      __x.param(typename chi_squared_distribution<_RealType>::
+		param_type(__n));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename cauchy_distribution<_RealType>::result_type
+      cauchy_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __p)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	  __aurng(__urng);
+	_RealType __u;
+	do
+	  __u = __aurng();
+	while (__u == 0.5);
+
+	const _RealType __pi = 3.1415926535897932384626433832795029L;
+	return __p.a() + __p.b() * std::tan(__pi * __u);
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const cauchy_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.a() << __space << __x.b();
+
+      __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,
+	       cauchy_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);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename cauchy_distribution<_RealType>::
+		param_type(__a, __b));
+
+      __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 fisher_f_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.m() << __space << __x.n()
+	   << __space << __x._M_gd_x << __space << __x._M_gd_y;
+
+      __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,
+	       fisher_f_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);
+
+      _RealType __m, __n;
+      __is >> __m >> __n >> __x._M_gd_x >> __x._M_gd_y;
+      __x.param(typename fisher_f_distribution<_RealType>::
+		param_type(__m, __n));
+
+      __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 student_t_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.n() << __space << __x._M_nd << __space << __x._M_gd;
+
+      __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,
+	       student_t_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);
+
+      _RealType __n;
+      __is >> __n >> __x._M_nd >> __x._M_gd;
+      __x.param(typename student_t_distribution<_RealType>::param_type(__n));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    void
+    gamma_distribution<_RealType>::param_type::
+    _M_initialize()
+    {
+      _M_malpha = _M_alpha < 1.0 ? _M_alpha + _RealType(1.0) : _M_alpha;
+
+      const _RealType __a1 = _M_malpha - _RealType(1.0) / _RealType(3.0);
+      _M_a2 = _RealType(1.0) / std::sqrt(_RealType(9.0) * __a1);
+    }
+
+  /**
+   * Marsaglia, G. and Tsang, W. W.
+   * "A Simple Method for Generating Gamma Variables"
+   * ACM Transactions on Mathematical Software, 26, 3, 363-372, 2000.
+   */
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename gamma_distribution<_RealType>::result_type
+      gamma_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	  __aurng(__urng);
+
+	result_type __u, __v, __n;
+	const result_type __a1 = (__param._M_malpha
+				  - _RealType(1.0) / _RealType(3.0));
+
+	do
+	  {
+	    do
+	      {
+		__n = _M_nd(__urng);
+		__v = result_type(1.0) + __param._M_a2 * __n; 
+	      }
+	    while (__v <= 0.0);
+
+	    __v = __v * __v * __v;
+	    __u = __aurng();
+	  }
+	while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n
+	       && (std::log(__u) > (0.5 * __n * __n + __a1
+				    * (1.0 - __v + std::log(__v)))));
+
+	if (__param.alpha() == __param._M_malpha)
+	  return __a1 * __v * __param.beta();
+	else
+	  {
+	    do
+	      __u = __aurng();
+	    while (__u == 0.0);
+	    
+	    return (std::pow(__u, result_type(1.0) / __param.alpha())
+		    * __a1 * __v * __param.beta());
+	  }
+      }
+
+  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();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.alpha() << __space << __x.beta()
+	   << __space << __x._M_nd;
+
+      __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,
+	       gamma_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);
+
+      _RealType __alpha_val, __beta_val;
+      __is >> __alpha_val >> __beta_val >> __x._M_nd;
+      __x.param(typename gamma_distribution<_RealType>::
+		param_type(__alpha_val, __beta_val));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename weibull_distribution<_RealType>::result_type
+      weibull_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __p)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	  __aurng(__urng);
+	return __p.b() * std::pow(-std::log(__aurng()),
+				  result_type(1) / __p.a());
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const weibull_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.a() << __space << __x.b();
+
+      __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,
+	       weibull_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);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename weibull_distribution<_RealType>::
+		param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename extreme_value_distribution<_RealType>::result_type
+      extreme_value_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __p)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+	  __aurng(__urng);
+	return __p.a() - __p.b() * std::log(-std::log(__aurng()));
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const extreme_value_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(std::numeric_limits<_RealType>::max_digits10);
+
+      __os << __x.a() << __space << __x.b();
+
+      __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,
+	       extreme_value_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);
+
+      _RealType __a, __b;
+      __is >> __a >> __b;
+      __x.param(typename extreme_value_distribution<_RealType>::
+		param_type(__a, __b));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    void
+    discrete_distribution<_IntType>::param_type::
+    _M_initialize()
+    {
+      if (_M_prob.size() < 2)
+	{
+	  _M_prob.clear();
+	  return;
+	}
+
+      const double __sum = std::accumulate(_M_prob.begin(),
+					   _M_prob.end(), 0.0);
+      // Now normalize the probabilites.
+      __detail::__transform(_M_prob.begin(), _M_prob.end(), _M_prob.begin(),
+			  std::bind2nd(std::divides<double>(), __sum));
+      // Accumulate partial sums.
+      _M_cp.reserve(_M_prob.size());
+      std::partial_sum(_M_prob.begin(), _M_prob.end(),
+		       std::back_inserter(_M_cp));
+      // Make sure the last cumulative probability is one.
+      _M_cp[_M_cp.size() - 1] = 1.0;
+    }
+
+  template<typename _IntType>
+    template<typename _Func>
+      discrete_distribution<_IntType>::param_type::
+      param_type(size_t __nw, double __xmin, double __xmax, _Func __fw)
+      : _M_prob(), _M_cp()
+      {
+	const size_t __n = __nw == 0 ? 1 : __nw;
+	const double __delta = (__xmax - __xmin) / __n;
+
+	_M_prob.reserve(__n);
+	for (size_t __k = 0; __k < __nw; ++__k)
+	  _M_prob.push_back(__fw(__xmin + __k * __delta + 0.5 * __delta));
+
+	_M_initialize();
+      }
+
+  template<typename _IntType>
+    template<typename _UniformRandomNumberGenerator>
+      typename discrete_distribution<_IntType>::result_type
+      discrete_distribution<_IntType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	if (__param._M_cp.empty())
+	  return result_type(0);
+
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+
+	const double __p = __aurng();
+	auto __pos = std::lower_bound(__param._M_cp.begin(),
+				      __param._M_cp.end(), __p);
+
+	return __pos - __param._M_cp.begin();
+      }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const discrete_distribution<_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 std::streamsize __precision = __os.precision();
+      const _CharT __space = __os.widen(' ');
+      __os.flags(__ios_base::scientific | __ios_base::left);
+      __os.fill(__space);
+      __os.precision(std::numeric_limits<double>::max_digits10);
+
+      std::vector<double> __prob = __x.probabilities();
+      __os << __prob.size();
+      for (auto __dit = __prob.begin(); __dit != __prob.end(); ++__dit)
+	__os << __space << *__dit;
+
+      __os.flags(__flags);
+      __os.fill(__fill);
+      __os.precision(__precision);
+      return __os;
+    }
+
+  template<typename _IntType, typename _CharT, typename _Traits>
+    std::basic_istream<_CharT, _Traits>&
+    operator>>(std::basic_istream<_CharT, _Traits>& __is,
+	       discrete_distribution<_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);
+
+      size_t __n;
+      __is >> __n;
+
+      std::vector<double> __prob_vec;
+      __prob_vec.reserve(__n);
+      for (; __n != 0; --__n)
+	{
+	  double __prob;
+	  __is >> __prob;
+	  __prob_vec.push_back(__prob);
+	}
+
+      __x.param(typename discrete_distribution<_IntType>::
+		param_type(__prob_vec.begin(), __prob_vec.end()));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    void
+    piecewise_constant_distribution<_RealType>::param_type::
+    _M_initialize()
+    {
+      if (_M_int.size() < 2
+	  || (_M_int.size() == 2
+	      && _M_int[0] == _RealType(0)
+	      && _M_int[1] == _RealType(1)))
+	{
+	  _M_int.clear();
+	  _M_den.clear();
+	  return;
+	}
+
+      const double __sum = std::accumulate(_M_den.begin(),
+					   _M_den.end(), 0.0);
+
+      __detail::__transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
+			    std::bind2nd(std::divides<double>(), __sum));
+
+      _M_cp.reserve(_M_den.size());
+      std::partial_sum(_M_den.begin(), _M_den.end(),
+		       std::back_inserter(_M_cp));
+
+      // Make sure the last cumulative probability is one.
+      _M_cp[_M_cp.size() - 1] = 1.0;
+
+      for (size_t __k = 0; __k < _M_den.size(); ++__k)
+	_M_den[__k] /= _M_int[__k + 1] - _M_int[__k];
+    }
+
+  template<typename _RealType>
+    template<typename _InputIteratorB, typename _InputIteratorW>
+      piecewise_constant_distribution<_RealType>::param_type::
+      param_type(_InputIteratorB __bbegin,
+		 _InputIteratorB __bend,
+		 _InputIteratorW __wbegin)
+      : _M_int(), _M_den(), _M_cp()
+      {
+	if (__bbegin != __bend)
+	  {
+	    for (;;)
+	      {
+		_M_int.push_back(*__bbegin);
+		++__bbegin;
+		if (__bbegin == __bend)
+		  break;
+
+		_M_den.push_back(*__wbegin);
+		++__wbegin;
+	      }
+	  }
+
+	_M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_constant_distribution<_RealType>::param_type::
+      param_type(initializer_list<_RealType> __bl, _Func __fw)
+      : _M_int(), _M_den(), _M_cp()
+      {
+	_M_int.reserve(__bl.size());
+	for (auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
+	  _M_int.push_back(*__biter);
+
+	_M_den.reserve(_M_int.size() - 1);
+	for (size_t __k = 0; __k < _M_int.size() - 1; ++__k)
+	  _M_den.push_back(__fw(0.5 * (_M_int[__k + 1] + _M_int[__k])));
+
+	_M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_constant_distribution<_RealType>::param_type::
+      param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
+      : _M_int(), _M_den(), _M_cp()
+      {
+	const size_t __n = __nw == 0 ? 1 : __nw;
+	const _RealType __delta = (__xmax - __xmin) / __n;
+
+	_M_int.reserve(__n + 1);
+	for (size_t __k = 0; __k <= __nw; ++__k)
+	  _M_int.push_back(__xmin + __k * __delta);
+
+	_M_den.reserve(__n);
+	for (size_t __k = 0; __k < __nw; ++__k)
+	  _M_den.push_back(__fw(_M_int[__k] + 0.5 * __delta));
+
+	_M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename piecewise_constant_distribution<_RealType>::result_type
+      piecewise_constant_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+
+	const double __p = __aurng();
+	if (__param._M_cp.empty())
+	  return __p;
+
+	auto __pos = std::lower_bound(__param._M_cp.begin(),
+				      __param._M_cp.end(), __p);
+	const size_t __i = __pos - __param._M_cp.begin();
+
+	const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
+
+	return __param._M_int[__i] + (__p - __pref) / __param._M_den[__i];
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const piecewise_constant_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(std::numeric_limits<_RealType>::max_digits10);
+
+      std::vector<_RealType> __int = __x.intervals();
+      __os << __int.size() - 1;
+
+      for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit)
+	__os << __space << *__xit;
+
+      std::vector<double> __den = __x.densities();
+      for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit)
+	__os << __space << *__dit;
+
+      __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,
+	       piecewise_constant_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);
+
+      size_t __n;
+      __is >> __n;
+
+      std::vector<_RealType> __int_vec;
+      __int_vec.reserve(__n + 1);
+      for (size_t __i = 0; __i <= __n; ++__i)
+	{
+	  _RealType __int;
+	  __is >> __int;
+	  __int_vec.push_back(__int);
+	}
+
+      std::vector<double> __den_vec;
+      __den_vec.reserve(__n);
+      for (size_t __i = 0; __i < __n; ++__i)
+	{
+	  double __den;
+	  __is >> __den;
+	  __den_vec.push_back(__den);
+	}
+
+      __x.param(typename piecewise_constant_distribution<_RealType>::
+	  param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin()));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _RealType>
+    void
+    piecewise_linear_distribution<_RealType>::param_type::
+    _M_initialize()
+    {
+      if (_M_int.size() < 2
+	  || (_M_int.size() == 2
+	      && _M_int[0] == _RealType(0)
+	      && _M_int[1] == _RealType(1)
+	      && _M_den[0] == _M_den[1]))
+	{
+	  _M_int.clear();
+	  _M_den.clear();
+	  return;
+	}
+
+      double __sum = 0.0;
+      _M_cp.reserve(_M_int.size() - 1);
+      _M_m.reserve(_M_int.size() - 1);
+      for (size_t __k = 0; __k < _M_int.size() - 1; ++__k)
+	{
+	  const _RealType __delta = _M_int[__k + 1] - _M_int[__k];
+	  __sum += 0.5 * (_M_den[__k + 1] + _M_den[__k]) * __delta;
+	  _M_cp.push_back(__sum);
+	  _M_m.push_back((_M_den[__k + 1] - _M_den[__k]) / __delta);
+	}
+
+      //  Now normalize the densities...
+      __detail::__transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
+			  std::bind2nd(std::divides<double>(), __sum));
+      //  ... and partial sums... 
+      __detail::__transform(_M_cp.begin(), _M_cp.end(), _M_cp.begin(),
+			    std::bind2nd(std::divides<double>(), __sum));
+      //  ... and slopes.
+      __detail::__transform(_M_m.begin(), _M_m.end(), _M_m.begin(),
+			    std::bind2nd(std::divides<double>(), __sum));
+      //  Make sure the last cumulative probablility is one.
+      _M_cp[_M_cp.size() - 1] = 1.0;
+     }
+
+  template<typename _RealType>
+    template<typename _InputIteratorB, typename _InputIteratorW>
+      piecewise_linear_distribution<_RealType>::param_type::
+      param_type(_InputIteratorB __bbegin,
+		 _InputIteratorB __bend,
+		 _InputIteratorW __wbegin)
+      : _M_int(), _M_den(), _M_cp(), _M_m()
+      {
+	for (; __bbegin != __bend; ++__bbegin, ++__wbegin)
+	  {
+	    _M_int.push_back(*__bbegin);
+	    _M_den.push_back(*__wbegin);
+	  }
+
+	_M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_linear_distribution<_RealType>::param_type::
+      param_type(initializer_list<_RealType> __bl, _Func __fw)
+      : _M_int(), _M_den(), _M_cp(), _M_m()
+      {
+	_M_int.reserve(__bl.size());
+	_M_den.reserve(__bl.size());
+	for (auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
+	  {
+	    _M_int.push_back(*__biter);
+	    _M_den.push_back(__fw(*__biter));
+	  }
+
+	_M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _Func>
+      piecewise_linear_distribution<_RealType>::param_type::
+      param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
+      : _M_int(), _M_den(), _M_cp(), _M_m()
+      {
+	const size_t __n = __nw == 0 ? 1 : __nw;
+	const _RealType __delta = (__xmax - __xmin) / __n;
+
+	_M_int.reserve(__n + 1);
+	_M_den.reserve(__n + 1);
+	for (size_t __k = 0; __k <= __nw; ++__k)
+	  {
+	    _M_int.push_back(__xmin + __k * __delta);
+	    _M_den.push_back(__fw(_M_int[__k] + __delta));
+	  }
+
+	_M_initialize();
+      }
+
+  template<typename _RealType>
+    template<typename _UniformRandomNumberGenerator>
+      typename piecewise_linear_distribution<_RealType>::result_type
+      piecewise_linear_distribution<_RealType>::
+      operator()(_UniformRandomNumberGenerator& __urng,
+		 const param_type& __param)
+      {
+	__detail::_Adaptor<_UniformRandomNumberGenerator, double>
+	  __aurng(__urng);
+
+	const double __p = __aurng();
+	if (__param._M_cp.empty())
+	  return __p;
+
+	auto __pos = std::lower_bound(__param._M_cp.begin(),
+				      __param._M_cp.end(), __p);
+	const size_t __i = __pos - __param._M_cp.begin();
+
+	const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
+
+	const double __a = 0.5 * __param._M_m[__i];
+	const double __b = __param._M_den[__i];
+	const double __cm = __p - __pref;
+
+	_RealType __x = __param._M_int[__i];
+	if (__a == 0)
+	  __x += __cm / __b;
+	else
+	  {
+	    const double __d = __b * __b + 4.0 * __a * __cm;
+	    __x += 0.5 * (std::sqrt(__d) - __b) / __a;
+          }
+
+        return __x;
+      }
+
+  template<typename _RealType, typename _CharT, typename _Traits>
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+	       const piecewise_linear_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(std::numeric_limits<_RealType>::max_digits10);
+
+      std::vector<_RealType> __int = __x.intervals();
+      __os << __int.size() - 1;
+
+      for (auto __xit = __int.begin(); __xit != __int.end(); ++__xit)
+	__os << __space << *__xit;
+
+      std::vector<double> __den = __x.densities();
+      for (auto __dit = __den.begin(); __dit != __den.end(); ++__dit)
+	__os << __space << *__dit;
+
+      __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,
+	       piecewise_linear_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);
+
+      size_t __n;
+      __is >> __n;
+
+      std::vector<_RealType> __int_vec;
+      __int_vec.reserve(__n + 1);
+      for (size_t __i = 0; __i <= __n; ++__i)
+	{
+	  _RealType __int;
+	  __is >> __int;
+	  __int_vec.push_back(__int);
+	}
+
+      std::vector<double> __den_vec;
+      __den_vec.reserve(__n + 1);
+      for (size_t __i = 0; __i <= __n; ++__i)
+	{
+	  double __den;
+	  __is >> __den;
+	  __den_vec.push_back(__den);
+	}
+
+      __x.param(typename piecewise_linear_distribution<_RealType>::
+	  param_type(__int_vec.begin(), __int_vec.end(), __den_vec.begin()));
+
+      __is.flags(__flags);
+      return __is;
+    }
+
+
+  template<typename _IntType>
+    seed_seq::seed_seq(std::initializer_list<_IntType> __il)
+    {
+      for (auto __iter = __il.begin(); __iter != __il.end(); ++__iter)
+	_M_v.push_back(__detail::__mod<result_type,
+		       __detail::_Shift<result_type, 32>::__value>(*__iter));
+    }
+
+  template<typename _InputIterator>
+    seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end)
+    {
+      for (_InputIterator __iter = __begin; __iter != __end; ++__iter)
+	_M_v.push_back(__detail::__mod<result_type,
+		       __detail::_Shift<result_type, 32>::__value>(*__iter));
+    }
+
+  template<typename _RandomAccessIterator>
+    void
+    seed_seq::generate(_RandomAccessIterator __begin,
+		       _RandomAccessIterator __end)
+    {
+      typedef typename iterator_traits<_RandomAccessIterator>::value_type
+        _Type;
+
+      if (__begin == __end)
+	return;
+
+      std::fill(__begin, __end, _Type(0x8b8b8b8bu));
+
+      const size_t __n = __end - __begin;
+      const size_t __s = _M_v.size();
+      const size_t __t = (__n >= 623) ? 11
+		       : (__n >=  68) ? 7
+		       : (__n >=  39) ? 5
+		       : (__n >=   7) ? 3
+		       : (__n - 1) / 2;
+      const size_t __p = (__n - __t) / 2;
+      const size_t __q = __p + __t;
+      const size_t __m = std::max(__s + 1, __n);
+
+      for (size_t __k = 0; __k < __m; ++__k)
+	{
+	  _Type __arg = (__begin[__k % __n]
+			 ^ __begin[(__k + __p) % __n]
+			 ^ __begin[(__k - 1) % __n]);
+	  _Type __r1 = __arg ^ (__arg >> 27);
+	  __r1 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value,
+	                         1664525u, 0u>(__r1);
+	  _Type __r2 = __r1;
+	  if (__k == 0)
+	    __r2 += __s;
+	  else if (__k <= __s)
+	    __r2 += __k % __n + _M_v[__k - 1];
+	  else
+	    __r2 += __k % __n;
+	  __r2 = __detail::__mod<_Type,
+	           __detail::_Shift<_Type, 32>::__value>(__r2);
+	  __begin[(__k + __p) % __n] += __r1;
+	  __begin[(__k + __q) % __n] += __r2;
+	  __begin[__k % __n] = __r2;
+	}
+
+      for (size_t __k = __m; __k < __m + __n; ++__k)
+	{
+	  _Type __arg = (__begin[__k % __n]
+			 + __begin[(__k + __p) % __n]
+			 + __begin[(__k - 1) % __n]);
+	  _Type __r3 = __arg ^ (__arg >> 27);
+	  __r3 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value,
+	                         1566083941u, 0u>(__r3);
+	  _Type __r4 = __r3 - __k % __n;
+	  __r4 = __detail::__mod<_Type,
+	           __detail::_Shift<_Type, 32>::__value>(__r4);
+	  __begin[(__k + __p) % __n] ^= __r3;
+	  __begin[(__k + __q) % __n] ^= __r4;
+	  __begin[__k % __n] = __r4;
+	}
+    }
+
+  template<typename _RealType, size_t __bits,
+	   typename _UniformRandomNumberGenerator>
+    _RealType
+    generate_canonical(_UniformRandomNumberGenerator& __urng)
+    {
+      const size_t __b
+	= std::min(static_cast<size_t>(std::numeric_limits<_RealType>::digits),
+                   __bits);
+      const long double __r = static_cast<long double>(__urng.max())
+			    - static_cast<long double>(__urng.min()) + 1.0L;
+      const size_t __log2r = std::log(__r) / std::log(2.0L);
+      size_t __k = std::max<size_t>(1UL, (__b + __log2r - 1UL) / __log2r);
+      _RealType __sum = _RealType(0);
+      _RealType __tmp = _RealType(1);
+      for (; __k != 0; --__k)
+	{
+	  __sum += _RealType(__urng() - __urng.min()) * __tmp;
+	  __tmp *= __r;
+	}
+      return __sum / __tmp;
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/range_access.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/range_access.h
new file mode 100644
index 0000000..0463791
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/range_access.h
@@ -0,0 +1,105 @@
+// <range_access.h> -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/range_access.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ */
+
+#ifndef _GLIBCXX_RANGE_ACCESS_H
+#define _GLIBCXX_RANGE_ACCESS_H 1
+
+#pragma GCC system_header
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    begin(_Container& __cont) -> decltype(__cont.begin())
+    { return __cont.begin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the const container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    begin(const _Container& __cont) -> decltype(__cont.begin())
+    { return __cont.begin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    end(_Container& __cont) -> decltype(__cont.end())
+    { return __cont.end(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the const container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    end(const _Container& __cont) -> decltype(__cont.end())
+    { return __cont.end(); }
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of the array.
+   *  @param  arr  Array.
+   */
+  template<class _Tp, size_t _Nm>
+    inline _Tp*
+    begin(_Tp (&__arr)[_Nm])
+    { return __arr; }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element
+   *          of the array.
+   *  @param  arr  Array.
+   */
+  template<class _Tp, size_t _Nm>
+    inline _Tp*
+    end(_Tp (&__arr)[_Nm])
+    { return __arr + _Nm; }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_RANGE_ACCESS_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex.h
new file mode 100644
index 0000000..2bea0c3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex.h
@@ -0,0 +1,2517 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+/**
+ * @defgroup regex Regular Expressions
+ * A facility for performing regular expression pattern matching.
+ */
+ //@{
+
+  // [7.7] Class regex_traits
+  /**
+   * @brief Describes aspects of a regular expression.
+   *
+   * A regular expression traits class that satisfies the requirements of 
+   * section [28.7].
+   *
+   * 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 Gets a sort key for a character sequence, independant of case.
+       *
+       * @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.
+       *
+       * @todo Implement this function.
+       */
+      template<typename _Fwd_iter>
+        string_type
+        transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
+        { return string_type(); }
+
+      /**
+       * @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
+        { return string_type(); }
+
+      /**
+       * @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.
+       * @param icase ignores the case of the classification name.
+       *
+       * @returns an unspecified value that represents the character
+       * classification named by the character sequence designated by the
+       * iterator range [first, last). If @p icase is true, the returned mask
+       * identifies the classification regardless of the case of the characters
+       * to be matched (for example, [[:lower:]] is the same as [[:alpha:]]),
+       * otherwise a case-dependant classification is returned.  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,
+	                 bool __icase = false) const
+	{ return 0; }
+
+      /**
+       * @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(__f, __c))
+	return true;
+      
+      // special case of underscore in [[:w:]]
+      if (__c == __ctype.widen('_'))
+	{
+	  const char __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 (__ctype.is(std::ctype_base::space, __c))
+	{
+	  const char __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;
+      if (__radix == 8)
+	__is >> std::oct;
+      else if (__radix == 16)
+	__is >> std::hex;
+      __is >> __v;
+      return __is.fail() ? -1 : __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 _Rx_traits                          traits_type;
+      typedef typename traits_type::string_type   string_type;
+      typedef regex_constants::syntax_option_type flag_type;
+      typedef typename traits_type::locale_type   locale_type;
+
+      /**
+       * @name Constants
+       * std [28.8.1](1)
+       */
+      //@{
+      static constexpr regex_constants::syntax_option_type icase
+        = regex_constants::icase;
+      static constexpr regex_constants::syntax_option_type nosubs
+        = regex_constants::nosubs;
+      static constexpr regex_constants::syntax_option_type optimize
+        = regex_constants::optimize;
+      static constexpr regex_constants::syntax_option_type collate
+        = regex_constants::collate;
+      static constexpr regex_constants::syntax_option_type ECMAScript
+        = regex_constants::ECMAScript;
+      static constexpr regex_constants::syntax_option_type basic
+        = regex_constants::basic;
+      static constexpr regex_constants::syntax_option_type extended
+        = regex_constants::extended;
+      static constexpr regex_constants::syntax_option_type awk
+        = regex_constants::awk;
+      static constexpr regex_constants::syntax_option_type grep
+        = regex_constants::grep;
+      static constexpr 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_automaton(__regex::__compile<const _Ch_type*, _Rx_traits>(0, 0,
+                     _M_traits, _M_flags))
+      { }
+
+      /**
+       * @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_automaton(__regex::__compile(__p, __p + _Rx_traits::length(__p),
+        				_M_traits, _M_flags))
+      { }
+
+      /**
+       * @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_automaton(__regex::__compile(__p, __p + __len, _M_traits, _M_flags))
+      { }
+
+      /**
+       * @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_traits(__rhs._M_traits),
+        _M_automaton(__rhs._M_automaton)
+      { }
+
+      /**
+       * @brief Move-constructs a basic regular expression.
+       *
+       * @param rhs A @p regex object.
+       */
+      basic_regex(const basic_regex&& __rhs) noexcept
+      : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits),
+        _M_automaton(std::move(__rhs._M_automaton))
+      { }
+
+      /**
+       * @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 std::basic_string<_Ch_type, _Ch_traits,
+		    _Ch_alloc>& __s,
+		    flag_type __f = regex_constants::ECMAScript)
+	: _M_flags(__f),
+	  _M_automaton(__regex::__compile(__s.begin(), __s.end(),
+	  				  _M_traits, _M_flags))
+        { }
+
+      /**
+       * @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_automaton(__regex::__compile(__first, __last, _M_traits, _M_flags))
+        { }
+
+      /**
+       * @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_automaton(__regex::__compile(__l.begin(), __l.end(),
+        				_M_traits, _M_flags))
+      { }
+
+      /**
+       * @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 Move-assigns one regular expression to another.
+       */
+      basic_regex&
+      operator=(basic_regex&& __rhs) noexcept
+      { return this->assign(std::move(__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 rhs Another regular expression object.
+       */
+      basic_regex&
+      assign(const basic_regex& __rhs)
+      {
+	basic_regex __tmp(__rhs);
+	this->swap(__tmp);
+	return *this;
+      }
+      
+      /**
+       * @brief The move-assignment operator.
+       *
+       * @param rhs Another regular expression object.
+       */
+      basic_regex&
+      assign(basic_regex&& __rhs) noexcept
+      {
+	basic_regex __tmp(std::move(__rhs));
+	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); }
+
+      /**
+       * @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); }
+
+      // [7.8.4] const operations
+      /**
+       * @brief Gets the number of marked subexpressions within the regular
+       * expression.
+       */
+      unsigned int
+      mark_count() const
+      { return _M_automaton->_M_sub_count() - 1; }
+      
+      /**
+       * @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_traits,    __rhs._M_traits);
+	std::swap(_M_automaton, __rhs._M_automaton);
+      }
+
+#ifdef _GLIBCXX_DEBUG
+      void
+      _M_dot(std::ostream& __ostr)
+      { _M_automaton->_M_dot(__ostr); }
+#endif
+      
+      const __regex::_AutomatonPtr&
+      _M_get_automaton() const
+      { return _M_automaton; }
+
+    protected:
+      flag_type              _M_flags;
+      _Rx_traits             _M_traits;
+      __regex::_AutomatonPtr _M_automaton;
+    };
+  
+  /** @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;
+      typedef std::basic_string<value_type>                     string_type;
+
+    public:
+      bool matched;
+      
+      constexpr sub_match() : 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 string_type() const
+      {
+	return this->matched
+	  ? string_type(this->first, this->second)
+	  : string_type();
+      }
+      
+      /**
+       * @brief Gets the matching sequence as a string.
+       *
+       * @returns the matching sequence as a string.
+       */
+      string_type
+      str() const
+      {
+	return this->matched
+	  ? string_type(this->first, this->second)
+	  : string_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 string_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 __rhs.compare(__lhs.c_str()) == 0; }
+
+  /**
+   * @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); }
+
+  /**
+   * @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 __rhs.compare(__lhs.c_str()) > 0; }
+
+  /**
+   * @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 __rhs < __lhs; }
+
+  /**
+   * @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); }
+
+  /**
+   * @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 !(__rhs < __lhs); }
+
+  /**
+   * @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.compare(__rhs.c_str()) == 0; }
+
+  /**
+   * @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 == __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.compare(__rhs.c_str()) < 0; }
+
+  /**
+   * @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 __rhs < __lhs; }
+
+  /**
+   * @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 < __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 !(__rhs < __lhs); }
+
+  /**
+   * @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 __rhs.compare(__lhs) == 0; }
+
+  /**
+   * @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); }
+
+  /**
+   * @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 __rhs.compare(__lhs) > 0; }
+
+  /**
+   * @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 __rhs < __lhs; }
+
+  /**
+   * @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); }
+
+  /**
+   * @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 !(__rhs < __lhs); }
+
+  /**
+   * @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.compare(__rhs) == 0; }
+
+  /**
+   * @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 == __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.compare(__rhs) < 0; }
+
+  /**
+   * @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 __rhs < __lhs; }
+
+  /**
+   * @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 < __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 !(__rhs < __lhs); }
+
+  /**
+   * @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 __rhs.compare(typename sub_match<_Bi_iter>::string_type(1, __lhs))
+             == 0;
+    }
+
+  /**
+   * @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); }
+
+  /**
+   * @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 __rhs.compare(typename sub_match<_Bi_iter>::string_type(1, __lhs))
+             > 0;
+    }
+
+  /**
+   * @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 __rhs < __lhs; }
+
+  /**
+   * @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); }
+
+  /**
+   * @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 !(__rhs < __lhs); }
+
+  /**
+   * @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.compare(typename sub_match<_Bi_iter>::string_type(1, __rhs))
+             == 0;
+    }
+
+  /**
+   * @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 == __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.compare(typename sub_match<_Bi_iter>::string_type(1, __rhs))
+             < 0;
+    }
+
+  /**
+   * @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 __rhs < __lhs; }
+
+  /**
+   * @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 < __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 !(__rhs < __lhs); }
+
+  /**
+   * @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
+
+  /*
+   * Special sub_match object representing an unmatched sub-expression.
+   */
+  template<typename _Bi_iter>
+    inline const sub_match<_Bi_iter>&
+    __unmatched_sub()
+    {
+      static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
+      return __unmatched;
+    }
+
+  /**
+   * @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<sub_match<_Bi_iter>, _Allocator>
+    {
+    private:
+      /*
+       * The vector base is empty if this does not represent a successful match.
+       * Otherwise it contains n+3 elements where n is the number of marked
+       * sub-expressions:
+       * [0] entire match
+       * [1] 1st marked subexpression
+       * ...
+       * [n] nth marked subexpression
+       * [n+1] prefix
+       * [n+2] suffix
+       */
+      typedef std::vector<sub_match<_Bi_iter>, _Allocator>    _Base_type;
+
+    public:
+      /**
+       * @name 10.? Public Types
+       */
+      //@{
+      typedef sub_match<_Bi_iter>                             value_type;
+      typedef const value_type&                               const_reference;
+      typedef const_reference                                 reference;
+      typedef typename _Base_type::const_iterator             const_iterator;
+      typedef const_iterator                                  iterator;
+      typedef typename std::iterator_traits<_Bi_iter>::difference_type
+                                                              difference_type;
+      /* TODO: needs allocator_traits */
+      typedef typename _Allocator::size_type                  size_type;
+      typedef _Allocator                                      allocator_type;
+      typedef typename std::iterator_traits<_Bi_iter>::value_type
+                                                              char_type;
+      typedef std::basic_string<char_type>                    string_type;
+      //@}
+  
+    public:
+      /**
+       * @name 28.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)
+      { }
+
+      /**
+       * @brief Copy constructs a %match_results.
+       */
+      match_results(const match_results& __rhs)
+      : _Base_type(__rhs)
+      { }
+
+      /**
+       * @brief Move constructs a %match_results.
+       */
+      match_results(match_results&& __rhs) noexcept
+      : _Base_type(std::move(__rhs))
+      { }
+
+      /**
+       * @brief Assigns rhs to *this.
+       */
+      match_results&
+      operator=(const match_results& __rhs)
+      {
+	match_results(__rhs).swap(*this);
+	return *this;
+      }
+
+      /**
+       * @brief Move-assigns rhs to *this.
+       */
+      match_results&
+      operator=(match_results&& __rhs)
+      {
+	match_results(std::move(__rhs)).swap(*this);
+	return *this;
+      }
+
+      /**
+       * @brief Destroys a %match_results object.
+       */
+      ~match_results()
+      { }
+      
+      //@}
+
+      // 28.10.2, state:
+      /**
+       * @brief Indicates if the %match_results is ready.
+       * @retval true   The object has a fully-established result state.
+       * @retval false  The object is not ready.
+       */
+      bool ready() const { return !_Base_type::empty(); }
+
+      /**
+       * @name 28.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
+      {
+      	size_type __size = _Base_type::size();
+      	return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
+      }
+      
+      size_type
+      max_size() const
+      { return _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.
+       * @pre   ready() == true
+       *
+       * 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 (*this)[__sub].length(); }
+
+      /**
+       * @brief Gets the offset of the beginning of the indicated submatch.
+       * @param sub indicates the submatch.
+       * @pre   ready() == true
+       *
+       * 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.
+       *
+       * Returns -1 if @p sub is out of range.
+       */
+      difference_type
+      position(size_type __sub = 0) const
+      {
+	return __sub < size() ? std::distance(this->prefix().first,
+					      (*this)[__sub].first) : -1;
+      }
+
+      /**
+       * @brief Gets the match or submatch converted to a string type.
+       * @param sub indicates the submatch.
+       * @pre   ready() == true
+       *
+       * 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 (*this)[__sub].str(); }
+      
+      /**
+       * @brief Gets a %sub_match reference for the match or submatch.
+       * @param sub indicates the submatch.
+       * @pre   ready() == true
+       *
+       * 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
+      { 
+      	_GLIBCXX_DEBUG_ASSERT( ready() );
+      	return __sub < size()
+	       ?  _Base_type::operator[](__sub)
+	       : __unmatched_sub<_Bi_iter>();
+      }
+
+      /**
+       * @brief Gets a %sub_match representing the match prefix.
+       * @pre   ready() == true
+       *
+       * 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
+      {
+      	_GLIBCXX_DEBUG_ASSERT( ready() );
+      	return !empty()
+      	       ? _Base_type::operator[](_Base_type::size() - 2)
+	       : __unmatched_sub<_Bi_iter>();
+      }
+
+      /**
+       * @brief Gets a %sub_match representing the match suffix.
+       * @pre   ready() == true
+       *
+       * 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
+      {
+	_GLIBCXX_DEBUG_ASSERT( ready() );
+	return !empty()
+	       ? _Base_type::operator[](_Base_type::size() - 1)
+	       : __unmatched_sub<_Bi_iter>();
+      }
+
+      /**
+       * @brief Gets an iterator to the start of the %sub_match collection.
+       */
+      const_iterator
+      begin() const
+      { return _Base_type::begin(); }
+      
+      /**
+       * @brief Gets an iterator to the start of the %sub_match collection.
+       */
+      const_iterator
+      cbegin() const
+      { return _Base_type::cbegin(); }
+
+      /**
+       * @brief Gets an iterator to one-past-the-end of the collection.
+       */
+      const_iterator
+      end() const
+      { return !empty() ? _Base_type::end() - 2 : _Base_type::end(); }
+      
+      /**
+       * @brief Gets an iterator to one-past-the-end of the collection.
+       */
+      const_iterator
+      cend() const
+      { return end(); }
+
+      //@}
+
+      /**
+       * @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.
+       */
+       //@{
+
+      /**
+       * @pre   ready() == true
+       * @todo Implement this function.
+       */
+      template<typename _Out_iter>
+        _Out_iter
+        format(_Out_iter __out, const char_type* __fmt_first,
+	       const char_type* __fmt_last,
+	       regex_constants::match_flag_type __flags
+	       = regex_constants::format_default) const
+        { return __out; }
+
+      /**
+       * @pre   ready() == true
+       */
+      template<typename _Out_iter, typename _St, typename _Sa>
+        _Out_iter
+        format(_Out_iter __out, const basic_string<char_type, _St, _Sa>& __fmt,
+	       regex_constants::match_flag_type __flags
+	       = regex_constants::format_default) const
+        {
+          return format(__out, __fmt.data(), __fmt.data() + __fmt.size(),
+                        __flags);
+        }
+
+      /**
+       * @pre   ready() == true
+       */
+      template<typename _Out_iter, typename _St, typename _Sa>
+        basic_string<char_type, _St, _Sa>
+        format(const basic_string<char_type, _St, _Sa>& __fmt,
+	       regex_constants::match_flag_type __flags
+	       = regex_constants::format_default) const
+        {
+          basic_string<char_type, _St, _Sa> __result;
+          format(std::back_inserter(__result), __fmt, __flags);
+          return __result;
+        }
+
+      /**
+       * @pre   ready() == true
+       */
+      string_type
+      format(const char_type* __fmt,
+	     regex_constants::match_flag_type __flags
+	     = regex_constants::format_default) const
+      {
+        string_type __result;
+        format(std::back_inserter(__result),
+               __fmt + char_traits<char_type>::length(__fmt),
+               __flags);
+        return __result;
+      }
+
+      //@} 
+
+      /**
+       * @name 10.5 Allocator
+       */
+      //@{ 
+
+      /**
+       * @brief Gets a copy of the allocator.
+       */
+      allocator_type
+      get_allocator() const
+      { return _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); }
+      //@} 
+      
+    private:
+      friend class __regex::_SpecializedResults<_Bi_iter, _Allocator>;
+    };
+  
+  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.
+   */
+  template<typename _Bi_iter, typename _Allocator>
+    inline bool
+    operator==(const match_results<_Bi_iter, _Allocator>& __m1,
+	       const match_results<_Bi_iter, _Allocator>& __m2)
+    {
+      if (__m1.ready() != __m2.ready())
+        return false;
+      if (!__m1.ready())  // both are not ready
+        return true;
+      if (__m1.empty() != __m2.empty())
+        return false;
+      if (__m1.empty())   // both are empty
+        return true;
+      return __m1.prefix() == __m2.prefix()
+        && __m1.size() == __m2.size()
+        && std::equal(__m1.begin(), __m1.end(), __m2.begin())
+        && __m1.suffix() == __m2.suffix();
+    }
+
+  /**
+   * @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 s     Start of the character sequence to match.
+   * @param e     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                                 __s,
+                _Bi_iter                                 __e,
+                match_results<_Bi_iter, _Allocator>&     __m,
+                const basic_regex<_Ch_type, _Rx_traits>& __re,
+                regex_constants::match_flag_type         __flags
+                               = regex_constants::match_default)
+    {
+      __regex::_AutomatonPtr __a = __re._M_get_automaton();
+      __regex::_Automaton::_SizeT __sz = __a->_M_sub_count();
+      __regex::_SpecializedCursor<_Bi_iter> __cs(__s, __e);
+      __regex::_SpecializedResults<_Bi_iter, _Allocator> __r(__sz, __cs, __m);
+      __regex::_Grep_matcher __matcher(__cs, __r, __a, __flags);
+      return __m[0].matched;
+    }
+
+  /**
+   * @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)
+    { return false; }
+
+  /**
+   * 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); }
+
+  // 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)
+    { return __out; }
+
+  /**
+   * @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)
+    {
+      basic_string<_Ch_type> __result;
+      regex_replace(std::back_inserter(__result),
+		    __s.begin(), __s.end(), __e, __fmt, __flags);
+      return __result;
+    }
+
+  //@}
+
+  // 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 @a 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::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
+  
+  //@} // group regex
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_compiler.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_compiler.h
new file mode 100644
index 0000000..025c4fa
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_compiler.h
@@ -0,0 +1,1109 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_compiler.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __regex
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  struct _Scanner_base
+  {
+    typedef unsigned int _StateT;
+
+    static constexpr _StateT _S_state_at_start    = 1 << 0;
+    static constexpr _StateT _S_state_in_brace    = 1 << 2;
+    static constexpr _StateT _S_state_in_bracket  = 1 << 3;
+
+    virtual ~_Scanner_base() { };
+  };
+
+  //
+  // @brief Scans an input range for regex tokens.
+  //
+  // The %_Scanner class interprets the regular expression pattern in the input
+  // range passed to its constructor as a sequence of parse tokens passed to
+  // the regular expression compiler.  The sequence of tokens provided depends
+  // on the flag settings passed to the constructor:  different regular
+  // expression grammars will interpret the same input pattern in
+  // syntactically different ways.
+  //
+  template<typename _InputIterator>
+    class _Scanner: public _Scanner_base
+    {
+    public:
+      typedef _InputIterator                                        _IteratorT;
+      typedef typename std::iterator_traits<_IteratorT>::value_type _CharT;
+      typedef std::basic_string<_CharT>                             _StringT;
+      typedef regex_constants::syntax_option_type                   _FlagT;
+      typedef const std::ctype<_CharT>                              _CtypeT;
+
+      // Token types returned from the scanner.
+      enum _TokenT
+      {
+	_S_token_anychar,
+	_S_token_backref,
+	_S_token_bracket_begin,
+	_S_token_bracket_end,
+	_S_token_inverse_class,
+	_S_token_char_class_name,
+	_S_token_closure0,
+	_S_token_closure1,
+	_S_token_collelem_multi,
+	_S_token_collelem_single,
+	_S_token_collsymbol,
+	_S_token_comma,
+	_S_token_dash,
+	_S_token_dup_count,
+	_S_token_eof,
+	_S_token_equiv_class_name,
+	_S_token_interval_begin,
+	_S_token_interval_end,
+	_S_token_line_begin,
+	_S_token_line_end,
+	_S_token_opt,
+	_S_token_or,
+	_S_token_ord_char,
+	_S_token_quoted_char,
+	_S_token_subexpr_begin,
+	_S_token_subexpr_end,
+	_S_token_word_begin,
+	_S_token_word_end,
+	_S_token_unknown
+      };
+
+    public:
+      _Scanner(_IteratorT __begin, _IteratorT __end, _FlagT __flags,
+	       std::locale __loc)
+      : _M_current(__begin) , _M_end(__end) , _M_flags(__flags),
+        _M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(_S_state_at_start)
+      { _M_advance(); }
+
+      void
+      _M_advance();
+
+      _TokenT
+      _M_token() const
+      { return _M_curToken; }
+
+      const _StringT&
+      _M_value() const
+      { return _M_curValue; }
+
+#ifdef _GLIBCXX_DEBUG
+      std::ostream&
+      _M_print(std::ostream&);
+#endif
+
+    private:
+      void
+      _M_eat_escape();
+
+      void
+      _M_scan_in_brace();
+
+      void
+      _M_scan_in_bracket();
+
+      void
+      _M_eat_charclass();
+
+      void
+      _M_eat_equivclass();
+
+      void
+      _M_eat_collsymbol();
+
+    private:
+      _IteratorT  _M_current;
+      _IteratorT  _M_end;
+      _FlagT      _M_flags;
+      _CtypeT&    _M_ctype;
+      _TokenT     _M_curToken;
+      _StringT    _M_curValue;
+      _StateT     _M_state;
+    };
+
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_advance()
+    {
+      if (_M_current == _M_end)
+	{
+	  _M_curToken = _S_token_eof;
+	  return;
+	}
+
+      _CharT __c = *_M_current;
+      if (_M_state & _S_state_in_bracket)
+	{
+	  _M_scan_in_bracket();
+	  return;
+	}
+      if (_M_state & _S_state_in_brace)
+	{
+	  _M_scan_in_brace();
+	  return;
+	}
+#if 0
+      // TODO: re-enable line anchors when _M_assertion is implemented.
+      // See PR libstdc++/47724
+      else if (_M_state & _S_state_at_start && __c == _M_ctype.widen('^'))
+	{
+	  _M_curToken = _S_token_line_begin;
+	  ++_M_current;
+	  return;
+	}
+      else if (__c == _M_ctype.widen('$'))
+	{
+	  _M_curToken = _S_token_line_end;
+	  ++_M_current;
+	  return;
+	}
+#endif
+      else if (__c == _M_ctype.widen('.'))
+	{
+	  _M_curToken = _S_token_anychar;
+	  ++_M_current;
+	  return;
+	}
+      else if (__c == _M_ctype.widen('*'))
+	{
+	  _M_curToken = _S_token_closure0;
+	  ++_M_current;
+	  return;
+	}
+      else if (__c == _M_ctype.widen('+'))
+	{
+	  _M_curToken = _S_token_closure1;
+	  ++_M_current;
+	  return;
+	}
+      else if (__c == _M_ctype.widen('|'))
+	{
+	  _M_curToken = _S_token_or;
+	  ++_M_current;
+	  return;
+	}
+      else if (__c == _M_ctype.widen('['))
+	{
+	  _M_curToken = _S_token_bracket_begin;
+	  _M_state |= (_S_state_in_bracket | _S_state_at_start);
+	  ++_M_current;
+	  return;
+	}
+      else if (__c == _M_ctype.widen('\\'))
+	{
+	  _M_eat_escape();
+	  return;
+	}
+      else if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+	{
+	  if (__c == _M_ctype.widen('('))
+	    {
+	      _M_curToken = _S_token_subexpr_begin;
+	      ++_M_current;
+	      return;
+	    }
+	  else if (__c == _M_ctype.widen(')'))
+	    {
+	      _M_curToken = _S_token_subexpr_end;
+	      ++_M_current;
+	      return;
+	    }
+	  else if (__c == _M_ctype.widen('{'))
+	    {
+	      _M_curToken = _S_token_interval_begin;
+	      _M_state |= _S_state_in_brace;
+	      ++_M_current;
+	      return;
+	    }
+	}
+
+      _M_curToken = _S_token_ord_char;
+      _M_curValue.assign(1, __c);
+      ++_M_current;
+    }
+
+
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_scan_in_brace()
+    {
+      if (_M_ctype.is(_CtypeT::digit, *_M_current))
+	{
+	  _M_curToken = _S_token_dup_count;
+	  _M_curValue.assign(1, *_M_current);
+	  ++_M_current;
+	  while (_M_current != _M_end
+		 && _M_ctype.is(_CtypeT::digit, *_M_current))
+	    {
+	      _M_curValue += *_M_current;
+	      ++_M_current;
+	    }
+	  return;
+	}
+      else if (*_M_current == _M_ctype.widen(','))
+	{
+	  _M_curToken = _S_token_comma;
+	  ++_M_current;
+	  return;
+	}
+      if (_M_flags & (regex_constants::basic | regex_constants::grep))
+	{
+	  if (*_M_current == _M_ctype.widen('\\'))
+	    _M_eat_escape();
+	}
+      else 
+	{
+	  if (*_M_current == _M_ctype.widen('}'))
+	    {
+	      _M_curToken = _S_token_interval_end;
+	      _M_state &= ~_S_state_in_brace;
+	      ++_M_current;
+	      return;
+	    }
+	}
+    }
+
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_scan_in_bracket()
+    {
+      if (_M_state & _S_state_at_start && *_M_current == _M_ctype.widen('^'))
+	{
+	  _M_curToken = _S_token_inverse_class;
+	  _M_state &= ~_S_state_at_start;
+	  ++_M_current;
+	  return;
+	}
+      else if (*_M_current == _M_ctype.widen('['))
+	{
+	  ++_M_current;
+	  if (_M_current == _M_end)
+	    {
+	      _M_curToken = _S_token_eof;
+	      return;
+	    }
+
+	  if (*_M_current == _M_ctype.widen('.'))
+	    {
+	      _M_curToken = _S_token_collsymbol;
+	      _M_eat_collsymbol();
+	      return;
+	    }
+	  else if (*_M_current == _M_ctype.widen(':'))
+	    {
+	      _M_curToken = _S_token_char_class_name;
+	      _M_eat_charclass();
+	      return;
+	    }
+	  else if (*_M_current == _M_ctype.widen('='))
+	    {
+	      _M_curToken = _S_token_equiv_class_name;
+	      _M_eat_equivclass();
+	      return;
+	    }
+	}
+      else if (*_M_current == _M_ctype.widen('-'))
+	{
+	  _M_curToken = _S_token_dash;
+	  ++_M_current;
+	  return;
+	}
+      else if (*_M_current == _M_ctype.widen(']'))
+	{
+	  if (!(_M_flags & regex_constants::ECMAScript)
+	      || !(_M_state & _S_state_at_start))
+	    {
+	      // special case: only if  _not_ chr first after
+	      // '[' or '[^' and if not ECMAscript
+	      _M_curToken = _S_token_bracket_end;
+	      ++_M_current;
+	      return;
+	    }
+	}
+      _M_curToken = _S_token_collelem_single;
+      _M_curValue.assign(1, *_M_current);
+      ++_M_current;
+    }
+
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_eat_escape()
+    {
+      ++_M_current;
+      if (_M_current == _M_end)
+	{
+	  _M_curToken = _S_token_eof;
+	  return;
+	}
+      _CharT __c = *_M_current;
+      ++_M_current;
+
+      if (__c == _M_ctype.widen('('))
+	{
+	  if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+	    {
+	      _M_curToken = _S_token_ord_char;
+	      _M_curValue.assign(1, __c);
+	    }
+	  else
+	    _M_curToken = _S_token_subexpr_begin;
+	}
+      else if (__c == _M_ctype.widen(')'))
+	{
+	  if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+	    {
+	      _M_curToken = _S_token_ord_char;
+	      _M_curValue.assign(1, __c);
+	    }
+	  else
+	    _M_curToken = _S_token_subexpr_end;
+	}
+      else if (__c == _M_ctype.widen('{'))
+	{
+	  if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+	    {
+	      _M_curToken = _S_token_ord_char;
+	      _M_curValue.assign(1, __c);
+	    }
+	  else
+	    {
+	      _M_curToken = _S_token_interval_begin;
+	      _M_state |= _S_state_in_brace;
+	    }
+	}
+      else if (__c == _M_ctype.widen('}'))
+	{
+	  if (!(_M_flags & (regex_constants::basic | regex_constants::grep)))
+	    {
+	      _M_curToken = _S_token_ord_char;
+	      _M_curValue.assign(1, __c);
+	    }
+	  else
+	    {
+	      if (!(_M_state && _S_state_in_brace))
+		__throw_regex_error(regex_constants::error_badbrace);
+	      _M_state &= ~_S_state_in_brace;
+	      _M_curToken = _S_token_interval_end;
+	    }
+	}
+      else if (__c == _M_ctype.widen('x'))
+	{
+	  ++_M_current;
+	  if (_M_current == _M_end)
+	    {
+	      _M_curToken = _S_token_eof;
+	      return;
+	    }
+	  if (_M_ctype.is(_CtypeT::digit, *_M_current))
+	    {
+	      _M_curValue.assign(1, *_M_current);
+	      ++_M_current;
+	      if (_M_current == _M_end)
+		{
+		  _M_curToken = _S_token_eof;
+		  return;
+		}
+	      if (_M_ctype.is(_CtypeT::digit, *_M_current))
+		{
+		  _M_curValue += *_M_current;
+		  ++_M_current;
+		  return;
+		}
+	    }
+	}
+      else if (__c == _M_ctype.widen('^')
+	       || __c == _M_ctype.widen('.')
+	       || __c == _M_ctype.widen('*')
+	       || __c == _M_ctype.widen('$')
+	       || __c == _M_ctype.widen('\\'))
+	{
+	  _M_curToken = _S_token_ord_char;
+	  _M_curValue.assign(1, __c);
+	}
+      else if (_M_ctype.is(_CtypeT::digit, __c))
+	{
+	  _M_curToken = _S_token_backref;
+	  _M_curValue.assign(1, __c);
+	}
+      else
+	__throw_regex_error(regex_constants::error_escape);
+    }
+
+
+  // Eats a character class or throwns an exception.
+  // current point to ':' delimiter on entry, char after ']' on return
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_eat_charclass()
+    {
+      ++_M_current; // skip ':'
+      if (_M_current == _M_end)
+	__throw_regex_error(regex_constants::error_ctype);
+      for (_M_curValue.clear();
+	   _M_current != _M_end && *_M_current != _M_ctype.widen(':');
+	   ++_M_current)
+	_M_curValue += *_M_current;
+      if (_M_current == _M_end)
+	__throw_regex_error(regex_constants::error_ctype);
+      ++_M_current; // skip ':'
+      if (*_M_current != _M_ctype.widen(']'))
+	__throw_regex_error(regex_constants::error_ctype);
+      ++_M_current; // skip ']'
+    }
+
+
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_eat_equivclass()
+    {
+      ++_M_current; // skip '='
+      if (_M_current == _M_end)
+	__throw_regex_error(regex_constants::error_collate);
+      for (_M_curValue.clear();
+	   _M_current != _M_end && *_M_current != _M_ctype.widen('=');
+	   ++_M_current)
+	_M_curValue += *_M_current;
+      if (_M_current == _M_end)
+	__throw_regex_error(regex_constants::error_collate);
+      ++_M_current; // skip '='
+      if (*_M_current != _M_ctype.widen(']'))
+	__throw_regex_error(regex_constants::error_collate);
+      ++_M_current; // skip ']'
+    }
+
+
+  template<typename _InputIterator>
+    void
+    _Scanner<_InputIterator>::
+    _M_eat_collsymbol()
+    {
+      ++_M_current; // skip '.'
+      if (_M_current == _M_end)
+	__throw_regex_error(regex_constants::error_collate);
+      for (_M_curValue.clear();
+	   _M_current != _M_end && *_M_current != _M_ctype.widen('.');
+	   ++_M_current)
+	_M_curValue += *_M_current;
+      if (_M_current == _M_end)
+	__throw_regex_error(regex_constants::error_collate);
+      ++_M_current; // skip '.'
+      if (*_M_current != _M_ctype.widen(']'))
+	__throw_regex_error(regex_constants::error_collate);
+      ++_M_current; // skip ']'
+    }
+
+#ifdef _GLIBCXX_DEBUG
+  template<typename _InputIterator>
+    std::ostream&
+    _Scanner<_InputIterator>::
+    _M_print(std::ostream& ostr)
+    {
+      switch (_M_curToken)
+      {
+	case _S_token_anychar:
+	  ostr << "any-character\n";
+	  break;
+	case _S_token_backref:
+	  ostr << "backref\n";
+	  break;
+	case _S_token_bracket_begin:
+	  ostr << "bracket-begin\n";
+	  break;
+	case _S_token_bracket_end:
+	  ostr << "bracket-end\n";
+	  break;
+	case _S_token_char_class_name:
+	  ostr << "char-class-name \"" << _M_curValue << "\"\n";
+	  break;
+	case _S_token_closure0:
+	  ostr << "closure0\n";
+	  break;
+	case _S_token_closure1:
+	  ostr << "closure1\n";
+	  break;
+	case _S_token_collelem_multi:
+	  ostr << "coll-elem-multi \"" << _M_curValue << "\"\n";
+	  break;
+	case _S_token_collelem_single:
+	  ostr << "coll-elem-single \"" << _M_curValue << "\"\n";
+	  break;
+	case _S_token_collsymbol:
+	  ostr << "collsymbol \"" << _M_curValue << "\"\n";
+	  break;
+	case _S_token_comma:
+	  ostr << "comma\n";
+	  break;
+	case _S_token_dash:
+	  ostr << "dash\n";
+	  break;
+	case _S_token_dup_count:
+	  ostr << "dup count: " << _M_curValue << "\n";
+	  break;
+	case _S_token_eof:
+	  ostr << "EOF\n";
+	  break;
+	case _S_token_equiv_class_name:
+	  ostr << "equiv-class-name \"" << _M_curValue << "\"\n";
+	  break;
+	case _S_token_interval_begin:
+	  ostr << "interval begin\n";
+	  break;
+	case _S_token_interval_end:
+	  ostr << "interval end\n";
+	  break;
+	case _S_token_line_begin:
+	  ostr << "line begin\n";
+	  break;
+	case _S_token_line_end:
+	  ostr << "line end\n";
+	  break;
+	case _S_token_opt:
+	  ostr << "opt\n";
+	  break;
+	case _S_token_or:
+	  ostr << "or\n";
+	  break;
+	case _S_token_ord_char:
+	  ostr << "ordinary character: \"" << _M_value() << "\"\n";
+	  break;
+	case _S_token_quoted_char:
+	  ostr << "quoted char\n";
+	  break;
+	case _S_token_subexpr_begin:
+	  ostr << "subexpr begin\n";
+	  break;
+	case _S_token_subexpr_end:
+	  ostr << "subexpr end\n";
+	  break;
+	case _S_token_word_begin:
+	  ostr << "word begin\n";
+	  break;
+	case _S_token_word_end:
+	  ostr << "word end\n";
+	  break;
+	case _S_token_unknown:
+	  ostr << "-- unknown token --\n";
+	  break;
+      }
+      return ostr;
+    }
+#endif
+
+  // Builds an NFA from an input iterator interval.
+  template<typename _InIter, typename _TraitsT>
+    class _Compiler
+    {
+    public:
+      typedef _InIter                                            _IterT;
+      typedef typename std::iterator_traits<_InIter>::value_type _CharT;
+      typedef std::basic_string<_CharT>                          _StringT;
+      typedef regex_constants::syntax_option_type                _FlagT;
+
+    public:
+      _Compiler(const _InIter& __b, const _InIter& __e,
+		_TraitsT& __traits, _FlagT __flags);
+
+      const _Nfa&
+      _M_nfa() const
+      { return _M_state_store; }
+
+    private:
+      typedef _Scanner<_InIter>                              _ScannerT;
+      typedef typename _ScannerT::_TokenT                    _TokenT;
+      typedef std::stack<_StateSeq, std::vector<_StateSeq> > _StackT;
+      typedef _RangeMatcher<_InIter, _TraitsT>               _RMatcherT;
+
+      // accepts a specific token or returns false.
+      bool
+      _M_match_token(_TokenT __token);
+
+      void
+      _M_disjunction();
+
+      bool
+      _M_alternative();
+
+      bool
+      _M_term();
+
+      bool
+      _M_assertion();
+
+      bool
+      _M_quantifier();
+
+      bool
+      _M_atom();
+
+      bool
+      _M_bracket_expression();
+
+      bool
+      _M_bracket_list(_RMatcherT& __matcher);
+
+      bool
+      _M_follow_list(_RMatcherT& __matcher);
+
+      bool
+      _M_follow_list2(_RMatcherT& __matcher);
+
+      bool
+      _M_expression_term(_RMatcherT& __matcher);
+
+      bool
+      _M_range_expression(_RMatcherT& __matcher);
+
+      bool
+      _M_start_range(_RMatcherT& __matcher);
+
+      bool
+      _M_collating_symbol(_RMatcherT& __matcher);
+
+      bool
+      _M_equivalence_class(_RMatcherT& __matcher);
+
+      bool
+      _M_character_class(_RMatcherT& __matcher);
+
+      int
+      _M_cur_int_value(int __radix);
+
+    private:
+      _TraitsT&      _M_traits;
+      _ScannerT      _M_scanner;
+      _StringT       _M_cur_value;
+      _Nfa           _M_state_store;
+      _StackT        _M_stack;
+    };
+
+  template<typename _InIter, typename _TraitsT>
+    _Compiler<_InIter, _TraitsT>::
+    _Compiler(const _InIter& __b, const _InIter& __e, _TraitsT& __traits,
+	      _Compiler<_InIter, _TraitsT>::_FlagT __flags)
+    : _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()),
+      _M_state_store(__flags)
+    {
+      typedef _StartTagger<_InIter, _TraitsT> _Start;
+      typedef _EndTagger<_InIter, _TraitsT> _End;
+
+      _StateSeq __r(_M_state_store,
+      		    _M_state_store._M_insert_subexpr_begin(_Start(0)));
+      _M_disjunction();
+      if (!_M_stack.empty())
+	{
+	  __r._M_append(_M_stack.top());
+	  _M_stack.pop();
+	}
+      __r._M_append(_M_state_store._M_insert_subexpr_end(0, _End(0)));
+      __r._M_append(_M_state_store._M_insert_accept());
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_match_token(_Compiler<_InIter, _TraitsT>::_TokenT token)
+    { 
+      if (token == _M_scanner._M_token())
+	{
+	  _M_cur_value = _M_scanner._M_value();
+	  _M_scanner._M_advance();
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    void
+    _Compiler<_InIter, _TraitsT>::
+    _M_disjunction()
+    {
+      this->_M_alternative();
+      if (_M_match_token(_ScannerT::_S_token_or))
+	{
+	  _StateSeq __alt1 = _M_stack.top(); _M_stack.pop();
+	  this->_M_disjunction();
+	  _StateSeq __alt2 = _M_stack.top(); _M_stack.pop();
+	  _M_stack.push(_StateSeq(__alt1, __alt2));
+	}
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_alternative()
+    {
+      if (this->_M_term())
+	{
+	  _StateSeq __re = _M_stack.top(); _M_stack.pop();
+	  this->_M_alternative();
+	  if (!_M_stack.empty())
+	    {
+	      __re._M_append(_M_stack.top());
+	      _M_stack.pop();
+	    }
+	  _M_stack.push(__re);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_term()
+    {
+      if (this->_M_assertion())
+	return true;
+      if (this->_M_atom())
+	{
+	  this->_M_quantifier();
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_assertion()
+    {
+      if (_M_match_token(_ScannerT::_S_token_line_begin))
+	{
+	  // __m.push(_Matcher::_S_opcode_line_begin);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_line_end))
+	{
+	  // __m.push(_Matcher::_S_opcode_line_end);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_word_begin))
+	{
+	  // __m.push(_Matcher::_S_opcode_word_begin);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_word_end))
+	{
+	  // __m.push(_Matcher::_S_opcode_word_end);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_quantifier()
+    {
+      if (_M_match_token(_ScannerT::_S_token_closure0))
+	{
+	  if (_M_stack.empty())
+	    __throw_regex_error(regex_constants::error_badrepeat);
+	  _StateSeq __r(_M_stack.top(), -1);
+	  __r._M_append(__r._M_front());
+	  _M_stack.pop();
+	  _M_stack.push(__r);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_closure1))
+	{
+	  if (_M_stack.empty())
+	    __throw_regex_error(regex_constants::error_badrepeat);
+	  _StateSeq __r(_M_state_store,
+			_M_state_store.
+			_M_insert_alt(_S_invalid_state_id,
+				      _M_stack.top()._M_front()));
+	  _M_stack.top()._M_append(__r);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_opt))
+	{
+	  if (_M_stack.empty())
+	  __throw_regex_error(regex_constants::error_badrepeat);
+	  _StateSeq __r(_M_stack.top(), -1);
+	  _M_stack.pop();
+	  _M_stack.push(__r);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_interval_begin))
+	{
+	  if (_M_stack.empty())
+	    __throw_regex_error(regex_constants::error_badrepeat);
+	  if (!_M_match_token(_ScannerT::_S_token_dup_count))
+	    __throw_regex_error(regex_constants::error_badbrace);
+	  _StateSeq __r(_M_stack.top());
+	  int __min_rep = _M_cur_int_value(10);
+	  for (int __i = 1; __i < __min_rep; ++__i)
+	    _M_stack.top()._M_append(__r._M_clone()); 
+	  if (_M_match_token(_ScannerT::_S_token_comma))
+	    if (_M_match_token(_ScannerT::_S_token_dup_count))
+	      {
+		int __n = _M_cur_int_value(10) - __min_rep;
+		if (__n < 0)
+		  __throw_regex_error(regex_constants::error_badbrace);
+		for (int __i = 0; __i < __n; ++__i)
+		  {
+		    _StateSeq __r(_M_state_store,
+				  _M_state_store.
+				  _M_insert_alt(_S_invalid_state_id,
+						_M_stack.top()._M_front()));
+		    _M_stack.top()._M_append(__r);
+		  }
+	      }
+	    else
+	      {
+		_StateSeq __r(_M_stack.top(), -1);
+		__r._M_push_back(__r._M_front());
+		_M_stack.pop();
+		_M_stack.push(__r);
+	      }
+	  if (!_M_match_token(_ScannerT::_S_token_interval_end))
+	    __throw_regex_error(regex_constants::error_brace);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_atom()
+    {
+      typedef _CharMatcher<_InIter, _TraitsT> _CMatcher;
+      typedef _StartTagger<_InIter, _TraitsT> _Start;
+      typedef _EndTagger<_InIter, _TraitsT> _End;
+
+      if (_M_match_token(_ScannerT::_S_token_anychar))
+	{
+	  _M_stack.push(_StateSeq(_M_state_store,
+                                  _M_state_store._M_insert_matcher
+                                  (_AnyMatcher)));
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_ord_char))
+	{
+	  _M_stack.push(_StateSeq(_M_state_store,
+                                  _M_state_store._M_insert_matcher
+                                  (_CMatcher(_M_cur_value[0], _M_traits))));
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_quoted_char))
+	{
+	  // note that in the ECMA grammar, this case covers backrefs.
+	  _M_stack.push(_StateSeq(_M_state_store,
+				  _M_state_store._M_insert_matcher
+				  (_CMatcher(_M_cur_value[0], _M_traits))));
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_backref))
+	{
+	  // __m.push(_Matcher::_S_opcode_ordchar, _M_cur_value);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_subexpr_begin))
+	{
+	  int __mark = _M_state_store._M_sub_count();
+	  _StateSeq __r(_M_state_store,
+			_M_state_store.
+			_M_insert_subexpr_begin(_Start(__mark)));
+	  this->_M_disjunction();
+	  if (!_M_match_token(_ScannerT::_S_token_subexpr_end))
+	    __throw_regex_error(regex_constants::error_paren);
+	  if (!_M_stack.empty())
+	    {
+	      __r._M_append(_M_stack.top());
+	      _M_stack.pop();
+	    }
+	  __r._M_append(_M_state_store._M_insert_subexpr_end
+			(__mark, _End(__mark)));
+	  _M_stack.push(__r);
+	  return true;
+	}
+      return _M_bracket_expression();
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_bracket_expression()
+    {
+      if (_M_match_token(_ScannerT::_S_token_bracket_begin))
+	{
+	  _RMatcherT __matcher(_M_match_token(_ScannerT::_S_token_line_begin),
+			       _M_traits);
+	  if (!_M_bracket_list(__matcher)
+	      || !_M_match_token(_ScannerT::_S_token_bracket_end))
+	    __throw_regex_error(regex_constants::error_brack);
+	  _M_stack.push(_StateSeq(_M_state_store,
+				  _M_state_store._M_insert_matcher(__matcher)));
+	  return true;
+	}
+      return false;
+    }
+
+  // If the dash is the last character in the bracket expression, it is not
+  // special.
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_bracket_list(_RMatcherT& __matcher)
+    {
+      if (_M_follow_list(__matcher))
+	{
+	  if (_M_match_token(_ScannerT::_S_token_dash))
+	    __matcher._M_add_char(_M_cur_value[0]);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_follow_list(_RMatcherT& __matcher)
+    { return _M_expression_term(__matcher) && _M_follow_list2(__matcher); }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_follow_list2(_RMatcherT& __matcher)
+    {
+      if (_M_expression_term(__matcher))
+	return _M_follow_list2(__matcher);
+      return true;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_expression_term(_RMatcherT& __matcher)
+    {
+      return (_M_collating_symbol(__matcher)
+	      || _M_character_class(__matcher)
+	      || _M_equivalence_class(__matcher)
+	      || (_M_start_range(__matcher)
+		  && _M_range_expression(__matcher)));
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_range_expression(_RMatcherT& __matcher)
+    {
+      if (!_M_collating_symbol(__matcher))
+	if (!_M_match_token(_ScannerT::_S_token_dash))
+	  __throw_regex_error(regex_constants::error_range);
+      __matcher._M_make_range();
+      return true;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_start_range(_RMatcherT& __matcher)
+    { return _M_match_token(_ScannerT::_S_token_dash); }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_collating_symbol(_RMatcherT& __matcher)
+    {
+      if (_M_match_token(_ScannerT::_S_token_collelem_single))
+	{
+	  __matcher._M_add_char(_M_cur_value[0]);
+	  return true;
+	}
+      if (_M_match_token(_ScannerT::_S_token_collsymbol))
+	{
+	  __matcher._M_add_collating_element(_M_cur_value);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_equivalence_class(_RMatcherT& __matcher)
+    {
+      if (_M_match_token(_ScannerT::_S_token_equiv_class_name))
+	{
+	  __matcher._M_add_equivalence_class(_M_cur_value);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    bool
+    _Compiler<_InIter, _TraitsT>::
+    _M_character_class(_RMatcherT& __matcher)
+    {
+      if (_M_match_token(_ScannerT::_S_token_char_class_name))
+	{
+	  __matcher._M_add_character_class(_M_cur_value);
+	  return true;
+	}
+      return false;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    int
+    _Compiler<_InIter, _TraitsT>::
+    _M_cur_int_value(int __radix)
+    {
+      int __v = 0;
+      for (typename _StringT::size_type __i = 0;
+	   __i < _M_cur_value.length(); ++__i)
+	__v =__v * __radix + _M_traits.value(_M_cur_value[__i], __radix);
+      return __v;
+    }
+
+  template<typename _InIter, typename _TraitsT>
+    _AutomatonPtr
+    __compile(const _InIter& __b, const _InIter& __e, _TraitsT& __t,
+	      regex_constants::syntax_option_type __f)
+    { return _AutomatonPtr(new _Nfa(_Compiler<_InIter, _TraitsT>(__b, __e, __t,
+                                        __f)._M_nfa())); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __regex
+} // namespace std
+
+/* vim: set ts=8 sw=2 sts=2: */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_constants.h
new file mode 100644
index 0000000..bddef3a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_constants.h
@@ -0,0 +1,301 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_constants.h
+ *  @brief Constant definitions for the std regex library.
+ *
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+/**
+ * @namespace std::regex_constants
+ * @brief ISO C++-0x entities sub namespace for regex.
+ */
+namespace regex_constants
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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 constexpr 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 constexpr 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 constexpr syntax_option_type optimize   = 1 << _S_optimize;
+
+  /**
+   * Specifies that character ranges of the form [a-b] should be locale
+   * sensitive.
+   */
+  static constexpr 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 section [28.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 constexpr 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 constexpr 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 constexpr 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:
+   * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos;, &apos;,
+   * and \\ddd (where ddd is one, two, or three octal digits).  
+   */
+  static constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr 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 constexpr match_flag_type match_not_eol     = 1 << _S_not_eol;
+   
+  /**
+   * The expression \\b is not matched against the sub-sequence
+   * [first,first).
+   */
+  static constexpr match_flag_type match_not_bow     = 1 << _S_not_bow;
+   
+  /**
+   * The expression \\b should not be matched against the sub-sequence
+   * [last,last).
+   */
+  static constexpr 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 constexpr match_flag_type match_any         = 1 << _S_any;
+   
+  /**
+   * The expression does not match an empty sequence.
+   */
+  static constexpr match_flag_type match_not_null    = 1 << _S_not_null;
+   
+  /**
+   * The expression only matches a sub-sequence that begins at first .
+   */
+  static constexpr 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 28.11 and iterators 28.12.
+   */
+  static constexpr 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 @a string that precedes the matched substring.
+   *         This would be match_results::prefix().
+   * @li $'  The portion of @a string 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 constexpr 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 constexpr 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 constexpr 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 constexpr match_flag_type format_first_only = 1 << _S_first_only;
+
+  //@}
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace regex_constants
+} // namespace
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_cursor.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_cursor.h
new file mode 100644
index 0000000..9feac1d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_cursor.h
@@ -0,0 +1,93 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_cursor.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __regex
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // ABC for pattern matching
+  struct _PatternCursor
+  {
+    virtual ~_PatternCursor() { };
+    virtual void _M_next() = 0;
+    virtual bool _M_at_end() const = 0;
+  };
+
+  // Provides a cursor into the specific target string.
+  template<typename _FwdIterT>
+    class _SpecializedCursor
+    : public _PatternCursor
+    {
+    public:
+      _SpecializedCursor(const _FwdIterT& __b, const _FwdIterT __e)
+      : _M_b(__b), _M_c(__b), _M_e(__e)
+      { }
+
+      typename std::iterator_traits<_FwdIterT>::value_type
+      _M_current() const
+      { return *_M_c; }
+
+      void
+      _M_next()
+      { ++_M_c; }
+
+      _FwdIterT
+      _M_pos() const
+      { return _M_c; }
+
+      const _FwdIterT&
+      _M_begin() const
+      { return _M_b; }
+
+      const _FwdIterT&
+      _M_end() const
+      { return _M_e; }
+
+      bool
+      _M_at_end() const
+      { return _M_c == _M_e; }
+
+    private:
+      _FwdIterT _M_b;
+      _FwdIterT _M_c;
+      _FwdIterT _M_e;
+    };
+
+  // Helper function to create a cursor specialized for an iterator class.
+  template<typename _FwdIterT>
+    inline _SpecializedCursor<_FwdIterT>
+    __cursor(const _FwdIterT& __b, const _FwdIterT __e)
+    { return _SpecializedCursor<_FwdIterT>(__b, __e); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __regex
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_error.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_error.h
new file mode 100644
index 0000000..c37a0fa
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_error.h
@@ -0,0 +1,161 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_error.h
+ * @brief Error and exception objects for the std regex library.
+ *
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace regex_constants
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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 constexpr error_type error_collate(_S_error_collate);
+
+  /** The expression contained an invalid character class name. */
+  static constexpr error_type error_ctype(_S_error_ctype);
+
+  /**
+   * The expression contained an invalid escaped character, or a trailing
+   * escape.
+   */
+  static constexpr error_type error_escape(_S_error_escape);
+
+  /** The expression contained an invalid back reference. */
+  static constexpr error_type error_backref(_S_error_backref);
+
+  /** The expression contained mismatched [ and ]. */
+  static constexpr error_type error_brack(_S_error_brack);
+
+  /** The expression contained mismatched ( and ). */
+  static constexpr error_type error_paren(_S_error_paren);
+
+  /** The expression contained mismatched { and } */
+  static constexpr error_type error_brace(_S_error_brace);
+
+  /** The expression contained an invalid range in a {} expression. */
+  static constexpr error_type error_badbrace(_S_error_badbrace);
+
+  /**
+   * The expression contained an invalid character range,
+   * such as [b-a] in most encodings.
+   */
+  static constexpr error_type error_range(_S_error_range);
+
+  /**
+   * There was insufficient memory to convert the expression into a
+   * finite state machine.
+   */
+  static constexpr error_type error_space(_S_error_space);
+
+  /**
+   * One of <em>*?+{<em> was not preceded by a valid regular expression.
+   */
+  static constexpr error_type error_badrepeat(_S_error_badrepeat);
+
+  /**
+   * The complexity of an attempted match against a regular expression
+   * exceeded a pre-set level.
+   */
+  static constexpr error_type error_complexity(_S_error_complexity);
+
+  /**
+   * There was insufficient memory to determine whether the
+   * regular expression could match the specified character sequence.
+   */
+  static constexpr error_type error_stack(_S_error_stack);
+
+  //@}
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace regex_constants
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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
+  {
+    regex_constants::error_type _M_code;
+
+  public:
+    /**
+     * @brief Constructs a regex_error object.
+     *
+     * @param ecode the regex error code.
+     */
+    explicit
+    regex_error(regex_constants::error_type __ecode);
+
+    virtual ~regex_error() throw();
+
+    /**
+     * @brief Gets the regex error code.
+     *
+     * @returns the regex error code.
+     */
+    regex_constants::error_type
+    code() const
+    { return _M_code; }
+  };
+
+
+  void
+  __throw_regex_error(regex_constants::error_type __ecode);
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.h
new file mode 100644
index 0000000..9312bb3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.h
@@ -0,0 +1,132 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_grep_matcher.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _BiIter>
+    class sub_match;
+
+  template<typename _Bi_iter, typename _Allocator>
+    class match_results;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+  
+namespace __regex
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // A _Results facade specialized for wrapping a templated match_results.
+  template<typename _FwdIterT, typename _Alloc>
+    class _SpecializedResults
+    : public _Results
+    {
+    public:
+      _SpecializedResults(const _Automaton::_SizeT __size,
+			  const _SpecializedCursor<_FwdIterT>& __cursor,
+			  match_results<_FwdIterT, _Alloc>& __m);
+
+      void
+      _M_set_pos(int __i, int __j, const _PatternCursor& __pc);
+
+      void
+      _M_set_matched(int __i, bool __is_matched)
+      { _M_results.at(__i).matched = __is_matched; }
+
+    private:
+      match_results<_FwdIterT, _Alloc>& _M_results;
+    };
+
+  template<typename _FwdIterT, typename _Alloc>
+    _SpecializedResults<_FwdIterT, _Alloc>::
+    _SpecializedResults(const _Automaton::_SizeT __size,
+    			const _SpecializedCursor<_FwdIterT>& __cursor,
+                        match_results<_FwdIterT, _Alloc>& __m)
+    : _M_results(__m)
+    {
+      _M_results.clear();
+      _M_results.reserve(__size + 2);
+      _M_results.resize(__size);
+      typename match_results<_FwdIterT, _Alloc>::value_type __sm;
+      __sm.first = __sm.second = __cursor._M_begin();
+      _M_results.push_back(__sm);
+      __sm.first = __sm.second = __cursor._M_end();
+      _M_results.push_back(__sm);
+    }
+
+  template<typename _FwdIterT, typename _Alloc>
+    void
+    _SpecializedResults<_FwdIterT, _Alloc>::
+    _M_set_pos(int __i, int __j, const _PatternCursor& __pc)
+    { 
+      typedef const _SpecializedCursor<_FwdIterT>& _CursorT;
+      _CursorT __c = static_cast<_CursorT>(__pc);
+      if (__j == 0)
+	_M_results.at(__i).first = __c._M_pos();
+      else
+	_M_results.at(__i).second = __c._M_pos()+1;
+    }
+
+  // A stack of states used in evaluating the NFA.
+  typedef std::stack<_StateIdT, std::vector<_StateIdT> > _StateStack;
+
+  // Executes a regular expression NFA/DFA over a range using a variant of
+  // the parallel execution algorithm featured in the grep utility, modified
+  // to use Laurikari tags.
+  class _Grep_matcher
+  {
+  public:
+    _Grep_matcher(_PatternCursor&                   __p,
+		  _Results&                         __r,
+		  const _AutomatonPtr&              __automaton,
+		  regex_constants::match_flag_type  __flags);
+
+  private:
+    _StateSet
+    _M_e_closure(_StateIdT __i);
+
+    _StateSet
+    _M_e_closure(const _StateSet& __s);
+
+    _StateSet
+    _M_e_closure(_StateStack& __stack, const _StateSet& __s);
+
+  private:
+    const std::shared_ptr<_Nfa>        _M_nfa;
+    _PatternCursor&                    _M_pattern;
+    _Results&                          _M_results;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __regex
+} // namespace
+
+#include <bits/regex_grep_matcher.tcc>
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.tcc
new file mode 100644
index 0000000..ae28f6f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.tcc
@@ -0,0 +1,179 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_grep_matcher.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+#include <regex>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace
+{
+  // A stack of states used in evaluating the NFA.
+  typedef std::stack<std::__regex::_StateIdT,
+                     std::vector<std::__regex::_StateIdT>
+		     > _StateStack;
+
+  // Obtains the next state set given the current state set __s and the current
+  // input character.
+  inline std::__regex::_StateSet
+  __move(const std::__regex::_PatternCursor& __p,
+         const std::__regex::_Nfa& __nfa,
+         const std::__regex::_StateSet& __s)
+  {
+    std::__regex::_StateSet __m;
+    for (std::__regex::_StateSet::const_iterator __i = __s.begin();
+	 __i != __s.end(); ++__i)
+      {
+	if (*__i == std::__regex::_S_invalid_state_id)
+	  continue;
+
+	const std::__regex::_State& __state = __nfa[*__i];
+	if (__state._M_opcode == std::__regex::_S_opcode_match
+	    && __state._M_matches(__p))
+	  __m.insert(__state._M_next);
+      }
+    return __m;
+  }
+
+  // returns true if (__s intersect __t) is not empty
+  inline bool
+  __includes_some(const std::__regex::_StateSet& __s,
+                  const std::__regex::_StateSet& __t)
+  {
+    if (__s.size() > 0 && __t.size() > 0)
+      {
+	std::__regex::_StateSet::const_iterator __first = __s.begin();
+	std::__regex::_StateSet::const_iterator __second = __t.begin();
+	while (__first != __s.end() && __second != __t.end())
+	  {
+	    if (*__first < *__second)
+	      ++__first;
+	    else if (*__second < *__first)
+	      ++__second;
+	    else
+	      return true;
+	  }
+      }
+    return false;
+  }
+
+  // If an identified state __u is not already in the current state set __e,
+  // insert it and push it on the current state stack __s.
+  inline void
+  __add_visited_state(const std::__regex::_StateIdT __u,
+                      _StateStack&                  __s,
+                      std::__regex::_StateSet&      __e)
+  {
+    if (__e.count(__u) == 0)
+      {
+	__e.insert(__u);
+	__s.push(__u);
+      }
+  }
+
+} // anonymous namespace
+
+namespace __regex
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  inline _Grep_matcher::
+  _Grep_matcher(_PatternCursor& __p, _Results& __r,
+		const _AutomatonPtr& __nfa,
+		regex_constants::match_flag_type __flags)
+  : _M_nfa(static_pointer_cast<_Nfa>(__nfa)), _M_pattern(__p), _M_results(__r)
+  {
+    __regex::_StateSet __t = this->_M_e_closure(_M_nfa->_M_start());
+    for (; !_M_pattern._M_at_end(); _M_pattern._M_next())
+      __t = this->_M_e_closure(__move(_M_pattern, *_M_nfa, __t));
+
+    _M_results._M_set_matched(0,
+                              __includes_some(_M_nfa->_M_final_states(), __t));
+  }
+
+  // Creates the e-closure set for the initial state __i.
+  inline _StateSet _Grep_matcher::
+  _M_e_closure(_StateIdT __i)
+  {
+    _StateSet __s;
+    __s.insert(__i);
+    _StateStack __stack;
+    __stack.push(__i);
+    return this->_M_e_closure(__stack, __s);
+  }
+
+  // Creates the e-closure set for an arbitrary state set __s.
+  inline _StateSet _Grep_matcher::
+  _M_e_closure(const _StateSet& __s)
+  {
+    _StateStack __stack;
+    for (_StateSet::const_iterator __i = __s.begin(); __i != __s.end(); ++__i)
+      __stack.push(*__i);
+    return this->_M_e_closure(__stack, __s);
+  }
+
+  inline _StateSet _Grep_matcher::
+  _M_e_closure(_StateStack& __stack, const _StateSet& __s)
+  {
+    _StateSet __e = __s;
+    while (!__stack.empty())
+      {
+	_StateIdT __t = __stack.top(); __stack.pop();
+	if (__t == _S_invalid_state_id)
+	  continue;
+	// for each __u with edge from __t to __u labeled e do ...
+	const _State& __state = _M_nfa->operator[](__t);
+	switch (__state._M_opcode)
+	  {
+	  case _S_opcode_alternative:
+	    __add_visited_state(__state._M_next, __stack, __e);
+	    __add_visited_state(__state._M_alt, __stack, __e);
+	    break;
+	  case _S_opcode_subexpr_begin:
+	    __add_visited_state(__state._M_next, __stack, __e);
+	    __state._M_tagger(_M_pattern, _M_results);
+	    break;
+	  case _S_opcode_subexpr_end:
+	    __add_visited_state(__state._M_next, __stack, __e);
+	    __state._M_tagger(_M_pattern, _M_results);
+	    _M_results._M_set_matched(__state._M_subexpr, true);
+	    break;
+	  case _S_opcode_accept:
+	    __add_visited_state(__state._M_next, __stack, __e);
+	    break;
+	  default:
+	    break;
+	  }
+      }
+    return __e;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __regex
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.h
new file mode 100644
index 0000000..c4a65e6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.h
@@ -0,0 +1,400 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_nfa.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __regex
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Base class for, um, automata.  Could be an NFA or a DFA.  Your choice.
+  class _Automaton
+  {
+  public:
+    typedef unsigned int _SizeT;
+
+  public:
+    virtual
+    ~_Automaton() { }
+
+    virtual _SizeT
+    _M_sub_count() const = 0;
+
+#ifdef _GLIBCXX_DEBUG
+    virtual std::ostream&
+    _M_dot(std::ostream& __ostr) const = 0;
+#endif
+  };
+
+  // Generic shared pointer to an automaton.  
+  typedef std::shared_ptr<_Automaton> _AutomatonPtr;
+
+  // Operation codes that define the type of transitions within the base NFA
+  // that represents the regular expression.
+  enum _Opcode
+  {
+      _S_opcode_unknown       =   0,
+      _S_opcode_alternative   =   1,
+      _S_opcode_subexpr_begin =   4,
+      _S_opcode_subexpr_end   =   5,
+      _S_opcode_match         = 100,
+      _S_opcode_accept        = 255
+  };
+
+  // Provides a generic facade for a templated match_results.
+  struct _Results
+  {
+    virtual void _M_set_pos(int __i, int __j, const _PatternCursor& __p) = 0;
+    virtual void _M_set_matched(int __i, bool __is_matched) = 0;
+  };
+
+  // Tags current state (for subexpr begin/end).
+  typedef std::function<void (const _PatternCursor&, _Results&)> _Tagger;
+
+  template<typename _FwdIterT, typename _TraitsT>
+    struct _StartTagger
+    {
+      explicit
+      _StartTagger(int __i)
+      : _M_index(__i)
+      { }
+
+      void
+      operator()(const _PatternCursor& __pc, _Results& __r)
+      { __r._M_set_pos(_M_index, 0, __pc); }
+
+      int       _M_index;
+    };
+
+  template<typename _FwdIterT, typename _TraitsT>
+    struct _EndTagger
+    {
+      explicit
+      _EndTagger(int __i)
+      : _M_index(__i)
+      { }
+
+      void
+      operator()(const _PatternCursor& __pc, _Results& __r)
+      { __r._M_set_pos(_M_index, 1, __pc); }
+
+      int       _M_index;
+      _FwdIterT _M_pos;
+    };
+  // Indicates if current state matches cursor current.
+  typedef std::function<bool (const _PatternCursor&)> _Matcher;
+
+  // Matches any character
+  inline bool
+  _AnyMatcher(const _PatternCursor&)
+  { return true; }
+
+  // Matches a single character
+  template<typename _InIterT, typename _TraitsT>
+    struct _CharMatcher
+    {
+      typedef typename _TraitsT::char_type char_type;
+
+      explicit
+      _CharMatcher(char_type __c, const _TraitsT& __t = _TraitsT())
+      : _M_traits(__t), _M_c(_M_traits.translate(__c))
+      { }
+
+      bool
+      operator()(const _PatternCursor& __pc) const
+      {
+	typedef const _SpecializedCursor<_InIterT>& _CursorT;
+	_CursorT __c = static_cast<_CursorT>(__pc);
+	return _M_traits.translate(__c._M_current()) == _M_c;
+      }
+
+      const _TraitsT& _M_traits;
+      char_type       _M_c;
+    };
+
+  // Matches a character range (bracket expression)
+  template<typename _InIterT, typename _TraitsT>
+    struct _RangeMatcher
+    {
+      typedef typename _TraitsT::char_type _CharT;
+      typedef std::basic_string<_CharT>    _StringT;
+
+      explicit
+      _RangeMatcher(bool __is_non_matching, const _TraitsT& __t = _TraitsT())
+      : _M_traits(__t), _M_is_non_matching(__is_non_matching)
+      { }
+
+      bool
+      operator()(const _PatternCursor& __pc) const
+      {
+	typedef const _SpecializedCursor<_InIterT>& _CursorT;
+	_CursorT __c = static_cast<_CursorT>(__pc);
+	return true;
+      }
+
+      void
+      _M_add_char(_CharT __c)
+      { }
+
+      void
+      _M_add_collating_element(const _StringT& __s)
+      { }
+
+      void
+      _M_add_equivalence_class(const _StringT& __s)
+      { }
+
+      void
+      _M_add_character_class(const _StringT& __s)
+      { }
+
+      void
+      _M_make_range()
+      { }
+
+      const _TraitsT& _M_traits;
+      bool            _M_is_non_matching;
+    };
+
+  // Identifies a state in the NFA.
+  typedef int _StateIdT;
+
+  // The special case in which a state identifier is not an index.
+  static const _StateIdT _S_invalid_state_id  = -1;
+
+
+  // An individual state in an NFA
+  //
+  // In this case a "state" is an entry in the NFA definition coupled with its
+  // outgoing transition(s).  All states have a single outgoing transition,
+  // except for accepting states (which have no outgoing transitions) and alt
+  // states, which have two outgoing transitions.
+  //
+  struct _State
+  {
+    typedef int  _OpcodeT;
+
+    _OpcodeT     _M_opcode;    // type of outgoing transition
+    _StateIdT    _M_next;      // outgoing transition
+    _StateIdT    _M_alt;       // for _S_opcode_alternative
+    unsigned int _M_subexpr;   // for _S_opcode_subexpr_*
+    _Tagger      _M_tagger;    // for _S_opcode_subexpr_*
+    _Matcher     _M_matches;   // for _S_opcode_match
+
+    explicit _State(_OpcodeT __opcode)
+    : _M_opcode(__opcode), _M_next(_S_invalid_state_id)
+    { }
+
+    _State(const _Matcher& __m)
+    : _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id), _M_matches(__m)
+    { }
+
+    _State(_OpcodeT __opcode, unsigned int __s, const _Tagger& __t)
+    : _M_opcode(__opcode), _M_next(_S_invalid_state_id), _M_subexpr(__s),
+      _M_tagger(__t)
+    { }
+
+    _State(_StateIdT __next, _StateIdT __alt)
+    : _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt)
+    { }
+
+#ifdef _GLIBCXX_DEBUG
+    std::ostream&
+    _M_print(std::ostream& ostr) const;
+
+    // Prints graphviz dot commands for state.
+    std::ostream&
+    _M_dot(std::ostream& __ostr, _StateIdT __id) const;
+#endif
+  };
+
+  
+  // The Grep Matcher works on sets of states.  Here are sets of states.
+  typedef std::set<_StateIdT> _StateSet;
+
+ // A collection of all states making up an NFA
+  //
+  // An NFA is a 4-tuple M = (K, S, s, F), where
+  //    K is a finite set of states,
+  //    S is the alphabet of the NFA,
+  //    s is the initial state,
+  //    F is a set of final (accepting) states.
+  //
+  // This NFA class is templated on S, a type that will hold values of the
+  // underlying alphabet (without regard to semantics of that alphabet).  The
+  // other elements of the tuple are generated during construction of the NFA
+  // and are available through accessor member functions.
+  //
+  class _Nfa
+  : public _Automaton, public std::vector<_State>
+  {
+  public:
+    typedef _State                              _StateT;
+    typedef unsigned int                        _SizeT;
+    typedef regex_constants::syntax_option_type _FlagT;
+
+  public:
+    _Nfa(_FlagT __f)
+    : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0)
+    { }
+
+    ~_Nfa()
+    { }
+
+    _FlagT
+    _M_options() const
+    { return _M_flags; }
+
+    _StateIdT
+    _M_start() const
+    { return _M_start_state; }
+
+    const _StateSet&
+    _M_final_states() const
+    { return _M_accepting_states; }
+
+    _SizeT
+    _M_sub_count() const
+    { return _M_subexpr_count; }
+
+    _StateIdT
+    _M_insert_accept()
+    {
+      this->push_back(_StateT(_S_opcode_accept));
+      _M_accepting_states.insert(this->size()-1);
+      return this->size()-1;
+    }
+
+    _StateIdT
+    _M_insert_alt(_StateIdT __next, _StateIdT __alt)
+    {
+      this->push_back(_StateT(__next, __alt));
+      return this->size()-1;
+    }
+
+    _StateIdT
+    _M_insert_matcher(_Matcher __m)
+    {
+      this->push_back(_StateT(__m));
+      return this->size()-1;
+    }
+
+    _StateIdT
+    _M_insert_subexpr_begin(const _Tagger& __t)
+    {
+      this->push_back(_StateT(_S_opcode_subexpr_begin, _M_subexpr_count++, __t));
+      return this->size()-1;
+    }
+
+    _StateIdT 
+    _M_insert_subexpr_end(unsigned int __i, const _Tagger& __t)
+    {
+      this->push_back(_StateT(_S_opcode_subexpr_end, __i, __t));
+      return this->size()-1;
+    }
+
+#ifdef _GLIBCXX_DEBUG
+    std::ostream&
+    _M_dot(std::ostream& __ostr) const;
+#endif
+
+  private:
+    _FlagT     _M_flags;
+    _StateIdT  _M_start_state;
+    _StateSet  _M_accepting_states;
+    _SizeT     _M_subexpr_count;
+  };
+
+  // Describes a sequence of one or more %_State, its current start and end(s).
+  //
+  // This structure contains fragments of an NFA during construction.
+  class _StateSeq
+  {
+  public:
+    // Constructs a single-node sequence
+    _StateSeq(_Nfa& __ss, _StateIdT __s, _StateIdT __e = _S_invalid_state_id)
+    : _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e)
+    { }
+    // Constructs a split sequence from two other sequencces
+    _StateSeq(const _StateSeq& __e1, const _StateSeq& __e2)
+    : _M_nfa(__e1._M_nfa),
+      _M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)),
+      _M_end1(__e1._M_end1), _M_end2(__e2._M_end1)
+    { }
+
+    // Constructs a split sequence from a single sequence
+    _StateSeq(const _StateSeq& __e, _StateIdT __id)
+    : _M_nfa(__e._M_nfa),
+      _M_start(_M_nfa._M_insert_alt(__id, __e._M_start)),
+      _M_end1(__id), _M_end2(__e._M_end1)
+    { }
+
+    // Constructs a copy of a %_StateSeq
+    _StateSeq(const _StateSeq& __rhs)
+    : _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start),
+      _M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2)
+    { }
+
+
+    _StateSeq& operator=(const _StateSeq& __rhs);
+
+    _StateIdT
+    _M_front() const
+    { return _M_start; }
+
+    // Extends a sequence by one.
+    void
+    _M_push_back(_StateIdT __id);
+
+    // Extends and maybe joins a sequence.
+    void
+    _M_append(_StateIdT __id);
+
+    void
+    _M_append(_StateSeq& __rhs);
+
+    // Clones an entire sequence.
+    _StateIdT
+    _M_clone();
+
+  private:
+    _Nfa&     _M_nfa;
+    _StateIdT _M_start;
+    _StateIdT _M_end1;
+    _StateIdT _M_end2;
+
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __regex
+} // namespace std
+
+#include <bits/regex_nfa.tcc>
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.tcc
new file mode 100644
index 0000000..9e4a6ce
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.tcc
@@ -0,0 +1,174 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/regex_nfa.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{regex}
+ */
+#include <regex>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __regex
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#ifdef _GLIBCXX_DEBUG
+inline std::ostream& _State::
+_M_print(std::ostream& ostr) const
+{
+  switch (_M_opcode)
+  {
+    case _S_opcode_alternative:
+      ostr << "alt next=" << _M_next << " alt=" << _M_alt;
+      break;
+    case _S_opcode_subexpr_begin:
+      ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr;
+      break;
+    case _S_opcode_subexpr_end:
+      ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr;
+      break;
+    case _S_opcode_match:
+      ostr << "match next=" << _M_next;
+      break;
+    case _S_opcode_accept:
+      ostr << "accept next=" << _M_next;
+      break;
+    default:
+      ostr << "unknown next=" << _M_next;
+      break;
+  }
+  return ostr;
+}
+
+// Prints graphviz dot commands for state.
+inline std::ostream& _State::
+_M_dot(std::ostream& __ostr, _StateIdT __id) const
+{
+  switch (_M_opcode)
+  {
+    case _S_opcode_alternative:
+      __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n" 
+             << __id << " -> " << _M_next
+             << " [label=\"epsilon\", tailport=\"s\"];\n"
+             << __id << " -> " << _M_alt 
+             << " [label=\"epsilon\", tailport=\"n\"];\n";
+      break;
+    case _S_opcode_subexpr_begin:
+      __ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
+             << _M_subexpr << "\"];\n" 
+             << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+      break;
+    case _S_opcode_subexpr_end:
+      __ostr << __id << " [label=\"" << __id << "\\nSEND "
+             << _M_subexpr << "\"];\n" 
+             << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+      break;
+    case _S_opcode_match:
+      __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n" 
+             << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
+      break;
+    case _S_opcode_accept:
+      __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
+      break;
+    default:
+      __ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n" 
+             << __id << " -> " << _M_next << " [label=\"?\"];\n";
+      break;
+  }
+  return __ostr;
+}
+
+inline std::ostream& _Nfa::
+_M_dot(std::ostream& __ostr) const
+{
+  __ostr << "digraph _Nfa {\n"
+   << "  rankdir=LR;\n";
+  for (unsigned int __i = 0; __i < this->size(); ++__i)
+  { this->at(__i)._M_dot(__ostr, __i); }
+  __ostr << "}\n";
+  return __ostr;
+}
+#endif
+
+inline _StateSeq& _StateSeq::
+operator=(const _StateSeq& __rhs)
+{
+  _M_start = __rhs._M_start;
+  _M_end1  = __rhs._M_end1;
+  _M_end2  = __rhs._M_end2;
+  return *this;
+}
+
+inline void _StateSeq::
+_M_push_back(_StateIdT __id)
+{
+  if (_M_end1 != _S_invalid_state_id)
+    _M_nfa[_M_end1]._M_next = __id;
+  _M_end1 = __id;
+}
+
+inline void _StateSeq::
+_M_append(_StateIdT __id)
+{
+  if (_M_end2 != _S_invalid_state_id)
+  {
+    if (_M_end2 == _M_end1)
+      _M_nfa[_M_end2]._M_alt = __id;
+    else
+      _M_nfa[_M_end2]._M_next = __id;
+    _M_end2 = _S_invalid_state_id;
+  }
+  if (_M_end1 != _S_invalid_state_id)
+    _M_nfa[_M_end1]._M_next = __id;
+  _M_end1 = __id;
+}
+
+inline void _StateSeq::
+_M_append(_StateSeq& __rhs)
+{
+  if (_M_end2 != _S_invalid_state_id)
+  {
+    if (_M_end2 == _M_end1)
+      _M_nfa[_M_end2]._M_alt = __rhs._M_start;
+    else
+      _M_nfa[_M_end2]._M_next = __rhs._M_start;
+    _M_end2 = _S_invalid_state_id;
+  }
+  if (__rhs._M_end2 != _S_invalid_state_id)
+    _M_end2 = __rhs._M_end2;
+  if (_M_end1 != _S_invalid_state_id)
+    _M_nfa[_M_end1]._M_next = __rhs._M_start;
+  _M_end1 = __rhs._M_end1;
+}
+
+// @todo implement this function.
+inline _StateIdT _StateSeq::
+_M_clone()
+{ return 0; }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __regex
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr.h
new file mode 100644
index 0000000..81ac382
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr.h
@@ -0,0 +1,569 @@
+// shared_ptr and weak_ptr implementation -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// GCC Note: Based on files from version 1.32.0 of the Boost library.
+
+//  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)
+
+/** @file bits/shared_ptr.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _SHARED_PTR_H
+#define _SHARED_PTR_H 1
+
+#include <bits/shared_ptr_base.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup pointer_abstractions
+   * @{
+   */
+
+  /// 2.2.3.7 shared_ptr I/O
+  template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
+    inline 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)
+    {
+#ifdef __GXX_RTTI
+      return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del)));
+#else
+      return 0;
+#endif
+    }
+
+
+  /**
+   *  @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:
+      /**
+       *  @brief  Construct an empty %shared_ptr.
+       *  @post   use_count()==0 && get()==0
+       */
+      constexpr shared_ptr()
+      : __shared_ptr<_Tp>() { }
+
+      shared_ptr(const shared_ptr&) = default; // 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)
+        : __shared_ptr<_Tp>(__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.
+       *
+       *  Requirements: _Deleter's copy constructor and destructor must
+       *  not throw
+       *
+       *  __shared_ptr will release __p by calling __d(__p)
+       */
+      template<typename _Tp1, typename _Deleter>
+	shared_ptr(_Tp1* __p, _Deleter __d)
+        : __shared_ptr<_Tp>(__p, __d) { }
+
+      /**
+       *  @brief  Construct a %shared_ptr that owns a null pointer
+       *          and the deleter @a __d.
+       *  @param  __p  A null pointer constant.
+       *  @param  __d  A deleter.
+       *  @post   use_count() == 1 && get() == __p
+       *  @throw  std::bad_alloc, in which case @a __d(__p) is called.
+       *
+       *  Requirements: _Deleter's copy constructor and destructor must
+       *  not throw
+       *
+       *  The last owner will call __d(__p)
+       */
+      template<typename _Deleter>
+	shared_ptr(nullptr_t __p, _Deleter __d)
+        : __shared_ptr<_Tp>(__p, __d) { }
+
+      /**
+       *  @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.
+       *
+       *  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)
+       */
+      template<typename _Tp1, typename _Deleter, typename _Alloc>
+	shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
+	: __shared_ptr<_Tp>(__p, __d, std::move(__a)) { }
+
+      /**
+       *  @brief  Construct a %shared_ptr that owns a null pointer
+       *          and the deleter @a __d.
+       *  @param  __p  A null pointer constant.
+       *  @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.
+       *
+       *  Requirements: _Deleter's copy constructor and destructor must
+       *  not throw _Alloc's copy constructor and destructor must not
+       *  throw.
+       *
+       *  The last owner will call __d(__p)
+       */
+      template<typename _Deleter, typename _Alloc>
+	shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
+	: __shared_ptr<_Tp>(__p, __d, std::move(__a)) { }
+
+      // Aliasing constructor
+
+      /**
+       *  @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>& __r, _Tp* __p)
+	: __shared_ptr<_Tp>(__r, __p) { }
+
+      /**
+       *  @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, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	shared_ptr(const shared_ptr<_Tp1>& __r)
+        : __shared_ptr<_Tp>(__r) { }
+
+      /**
+       *  @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)
+      : __shared_ptr<_Tp>(std::move(__r)) { }
+
+      /**
+       *  @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, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	shared_ptr(shared_ptr<_Tp1>&& __r)
+	: __shared_ptr<_Tp>(std::move(__r)) { }
+
+      /**
+       *  @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>& __r)
+	: __shared_ptr<_Tp>(__r) { }
+
+#if _GLIBCXX_USE_DEPRECATED
+      template<typename _Tp1>
+	shared_ptr(std::auto_ptr<_Tp1>&& __r)
+	: __shared_ptr<_Tp>(std::move(__r)) { }
+#endif
+
+      template<typename _Tp1, typename _Del>
+	shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
+	: __shared_ptr<_Tp>(std::move(__r)) { }
+
+      /**
+       *  @brief  Construct an empty %shared_ptr.
+       *  @param  __p  A null pointer constant.
+       *  @post   use_count() == 0 && get() == nullptr
+       */
+      constexpr shared_ptr(nullptr_t __p)
+      : __shared_ptr<_Tp>(__p) { }
+
+      shared_ptr& operator=(const shared_ptr&) = default;
+
+      template<typename _Tp1>
+	shared_ptr&
+	operator=(const shared_ptr<_Tp1>& __r) // never throws
+	{
+	  this->__shared_ptr<_Tp>::operator=(__r);
+	  return *this;
+	}
+
+#if _GLIBCXX_USE_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=(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, const _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(const _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 _Tp>
+    inline bool
+    operator==(const shared_ptr<_Tp>& __a, nullptr_t)
+    { return __a.get() == nullptr; }
+
+  template<typename _Tp>
+    inline bool
+    operator==(nullptr_t, const shared_ptr<_Tp>& __b)
+    { return nullptr == __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>
+    inline bool
+    operator!=(const shared_ptr<_Tp>& __a, nullptr_t)
+    { return __a.get() != nullptr; }
+
+  template<typename _Tp>
+    inline bool
+    operator!=(nullptr_t, const shared_ptr<_Tp>& __b)
+    { return nullptr != __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); }
+
+  // 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:
+      constexpr weak_ptr()
+      : __weak_ptr<_Tp>() { }
+
+      template<typename _Tp1, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	weak_ptr(const weak_ptr<_Tp1>& __r)
+	: __weak_ptr<_Tp>(__r) { }
+
+      template<typename _Tp1, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	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
+      }
+    };
+
+  // 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); }
+
+
+  /// Primary template owner_less
+  template<typename _Tp>
+    struct owner_less;
+
+  /// Partial specialization of owner_less for shared_ptr.
+  template<typename _Tp>
+    struct owner_less<shared_ptr<_Tp>>
+    : public _Sp_owner_less<shared_ptr<_Tp>, weak_ptr<_Tp>>
+    { };
+
+  /// Partial specialization of owner_less for weak_ptr.
+  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:
+      constexpr 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;
+    };
+
+  /**
+   *  @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(const _Alloc& __a, _Args&&... __args)
+    {
+      return shared_ptr<_Tp>(_Sp_make_shared_tag(), __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 std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(),
+				       std::forward<_Args>(__args)...);
+    }
+
+  /// std::hash specialization for shared_ptr.
+  template<typename _Tp>
+    struct hash<shared_ptr<_Tp>>
+    : public std::unary_function<shared_ptr<_Tp>, size_t>
+    {
+      size_t
+      operator()(const shared_ptr<_Tp>& __s) const noexcept
+      { return std::hash<_Tp*>()(__s.get()); }
+    };
+
+  // @} group pointer_abstractions
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _SHARED_PTR_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr_base.h
new file mode 100644
index 0000000..7badc39
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr_base.h
@@ -0,0 +1,1386 @@
+// shared_ptr and weak_ptr implementation details -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// GCC Note: Based on files from version 1.32.0 of the Boost library.
+
+//  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)
+
+/** @file bits/shared_ptr_base.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _SHARED_PTR_BASE_H
+#define _SHARED_PTR_BASE_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ /**
+   *  @brief  Exception possibly thrown by @c shared_ptr.
+   *  @ingroup exceptions
+   */
+  class bad_weak_ptr : public std::exception
+  {
+  public:
+    virtual char const*
+    what() const throw();
+
+    virtual ~bad_weak_ptr() throw();    
+  };
+
+  // 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
+      {
+        // Be race-detector-friendly.  For more info see bits/c++config.
+        _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
+	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
+	  {
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
+	    _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;
+	      }
+
+            // Be race-detector-friendly.  For more info see bits/c++config.
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+	    if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
+						       -1) == 1)
+              {
+                _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+	        _M_destroy();
+              }
+	  }
+      }
+  
+      void
+      _M_weak_add_ref() // nothrow
+      { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
+
+      void
+      _M_weak_release() // nothrow
+      {
+        // Be race-detector-friendly. For more info see bits/c++config.
+        _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
+	  {
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+	    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));
+    }
+
+
+  // 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>
+    struct owner_less;
+
+  template<typename _Tp>
+    class enable_shared_from_this;
+
+  template<_Lock_policy _Lp = __default_lock_policy>
+    class __weak_count;
+
+  template<_Lock_policy _Lp = __default_lock_policy>
+    class __shared_count;
+
+
+  // Counted ptr with no deleter or allocator support
+  template<typename _Ptr, _Lock_policy _Lp>
+    class _Sp_counted_ptr : public _Sp_counted_base<_Lp>
+    {
+    public:
+      explicit
+      _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&)
+      { 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
+    };
+
+  template<>
+    inline void
+    _Sp_counted_ptr<nullptr_t, _S_single>::_M_dispose() { }
+
+  template<>
+    inline void
+    _Sp_counted_ptr<nullptr_t, _S_mutex>::_M_dispose() { }
+
+  template<>
+    inline void
+    _Sp_counted_ptr<nullptr_t, _S_atomic>::_M_dispose() { }
+
+  // Support for custom deleter and/or allocator
+  template<typename _Ptr, typename _Deleter, typename _Alloc, _Lock_policy _Lp>
+    class _Sp_counted_deleter : public _Sp_counted_base<_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) { }
+      };
+
+    public:
+      // __d(__p) must not throw.
+      _Sp_counted_deleter(_Ptr __p, _Deleter __d)
+      : _M_ptr(__p), _M_del(__d, _Alloc()) { }
+
+      // __d(__p) must not throw.
+      _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a)
+      : _M_ptr(__p), _M_del(__d, __a) { }
+
+      virtual void
+      _M_dispose() // nothrow
+      { _M_del._M_del(_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)
+      {
+#ifdef __GXX_RTTI
+        return __ti == typeid(_Deleter) ? &_M_del._M_del : 0;
+#else
+        return 0;
+#endif
+      }
+
+    protected:
+      _Ptr             _M_ptr;  // copy constructor must not throw
+      _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:
+      explicit
+      _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::_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::_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)
+      {
+#ifdef __GXX_RTTI
+	return __ti == typeid(_Sp_make_shared_tag)
+	       ? static_cast<void*>(&_M_storage)
+	       : _Base_type::_M_get_deleter(__ti);
+#else
+        return 0;
+#endif
+      }
+
+    private:
+      typename aligned_storage<sizeof(_Tp), alignment_of<_Tp>::value>::type
+	_M_storage;
+    };
+
+  template<_Lock_policy _Lp>
+    class __shared_count
+    {
+    public:
+      constexpr __shared_count() : _M_pi(0) // nothrow
+      { }
+
+      template<typename _Ptr>
+        explicit
+	__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)
+	{
+	  // The 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*, const _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_USE_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:
+      constexpr __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();
+    }
+
+
+  // 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;
+
+      constexpr __shared_ptr()
+      : _M_ptr(0), _M_refcount() // never throws
+      { }
+
+      template<typename _Tp1>
+	explicit __shared_ptr(_Tp1* __p)
+        : _M_ptr(__p), _M_refcount(__p)
+	{
+	  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+	  static_assert( sizeof(_Tp1) > 0, "incomplete type" );
+	  __enable_shared_from_this_helper(_M_refcount, __p, __p);
+	}
+
+      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);
+	}
+
+      template<typename _Tp1, typename _Deleter, typename _Alloc>
+	__shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a)
+	: _M_ptr(__p), _M_refcount(__p, __d, std::move(__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);
+	}
+
+      template<typename _Deleter>
+	__shared_ptr(nullptr_t __p, _Deleter __d)
+	: _M_ptr(0), _M_refcount(__p, __d)
+	{ }
+
+      template<typename _Deleter, typename _Alloc>
+        __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a)
+	: _M_ptr(0), _M_refcount(__p, __d, std::move(__a))
+	{ }
+
+      template<typename _Tp1>
+	__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p)
+	: _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws
+	{ }
+
+      __shared_ptr(const __shared_ptr&) = default; // never throws
+      __shared_ptr& operator=(const __shared_ptr&) = default; // never throws
+
+      template<typename _Tp1, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	__shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+	: _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+	{ }
+
+      __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;
+      }
+
+      template<typename _Tp1, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	__shared_ptr(__shared_ptr<_Tp1, _Lp>&& __r)
+	: _M_ptr(__r._M_ptr), _M_refcount() // never throws
+	{
+	  _M_refcount._M_swap(__r._M_refcount);
+	  __r._M_ptr = 0;
+	}
+
+      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 an exception is thrown this constructor has no effect.
+      template<typename _Tp1, typename _Del>
+	__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_USE_DEPRECATED
+      // Postcondition: use_count() == 1 and __r.get() == 0
+      template<typename _Tp1>
+	__shared_ptr(std::auto_ptr<_Tp1>&& __r)
+	: _M_ptr(__r.get()), _M_refcount()
+	{
+	  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+	  static_assert( sizeof(_Tp1) > 0, "incomplete type" );
+	  _Tp1* __tmp = __r.get();
+	  _M_refcount = __shared_count<_Lp>(std::move(__r));
+	  __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+	}
+#endif
+
+      /* TODO: use delegating constructor */
+      constexpr __shared_ptr(nullptr_t)
+      : _M_ptr(0), _M_refcount() // never throws
+      { }
+
+      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_USE_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=(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, _Alloc __a)
+        { __shared_ptr(__p, __d, std::move(__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; }
+
+      explicit operator bool() const // never throws
+      { return _M_ptr == 0 ? false : true; }
+
+      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); }
+
+#ifdef __GXX_RTTI
+    protected:
+      // This constructor is non-standard, it is used by allocate_shared.
+      template<typename _Alloc, typename... _Args>
+	__shared_ptr(_Sp_make_shared_tag __tag, const _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);
+	}
+#else
+      template<typename _Alloc>
+        struct _Deleter
+        {
+          void operator()(_Tp* __ptr)
+          {
+            _M_alloc.destroy(__ptr);
+            _M_alloc.deallocate(__ptr, 1);
+          }
+          _Alloc _M_alloc;
+        };
+
+      template<typename _Alloc, typename... _Args>
+	__shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a,
+		     _Args&&... __args)
+	: _M_ptr(), _M_refcount()
+        {
+	  typedef typename _Alloc::template rebind<_Tp>::other _Alloc2;
+          _Deleter<_Alloc2> __del = { _Alloc2(__a) };
+          _M_ptr = __del._M_alloc.allocate(1);
+	  __try
+	    {
+              __del._M_alloc.construct(_M_ptr, std::forward<_Args>(__args)...);
+	    }
+	  __catch(...)
+	    {
+              __del._M_alloc.deallocate(_M_ptr, 1);
+	      __throw_exception_again;
+	    }
+          __shared_count<_Lp> __count(_M_ptr, __del, __del._M_alloc);
+          _M_refcount._M_swap(__count);
+	  __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
+        }
+#endif
+
+      template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc,
+	       typename... _Args>
+	friend __shared_ptr<_Tp1, _Lp1>
+	__allocate_shared(const _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 _Tp, _Lock_policy _Lp>
+    inline bool
+    operator==(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t)
+    { return __a.get() == nullptr; }
+
+  template<typename _Tp, _Lock_policy _Lp>
+    inline bool
+    operator==(nullptr_t, const __shared_ptr<_Tp, _Lp>& __b)
+    { return nullptr == __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 _Tp, _Lock_policy _Lp>
+    inline bool
+    operator!=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t)
+    { return __a.get() != nullptr; }
+
+  template<typename _Tp, _Lock_policy _Lp>
+    inline bool
+    operator!=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __b)
+    { return nullptr != __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
+      {
+	typedef typename _Sp::element_type element_type;
+	return std::less<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>>
+    { };
+
+  // 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
+
+  // The seemingly equivalent code:
+  // shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))
+  // will eventually result in undefined behaviour, attempting to
+  // delete the same object twice.
+  /// static_pointer_cast
+  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())); }
+
+  // The seemingly equivalent code:
+  // shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))
+  // will eventually result in undefined behaviour, attempting to
+  // delete the same object twice.
+  /// const_pointer_cast
+  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())); }
+
+  // The seemingly equivalent code:
+  // shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))
+  // will eventually result in undefined behaviour, attempting to
+  // delete the same object twice.
+  /// dynamic_pointer_cast
+  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>();
+    }
+
+
+  template<typename _Tp, _Lock_policy _Lp>
+    class __weak_ptr
+    {
+    public:
+      typedef _Tp element_type;
+
+      constexpr __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, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	__weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+	: _M_refcount(__r._M_refcount) // never throws
+        { _M_ptr = __r.lock().get(); }
+
+      template<typename _Tp1, typename = typename
+	       std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type>
+	__weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+	: _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+	{ }
+
+      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);
+      }
+
+    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); }
+
+  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:
+      constexpr __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;
+    };
+
+
+  template<typename _Tp, _Lock_policy _Lp, typename _Alloc, typename... _Args>
+    inline __shared_ptr<_Tp, _Lp>
+    __allocate_shared(const _Alloc& __a, _Args&&... __args)
+    {
+      return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(), __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 std::__allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(),
+					      std::forward<_Args>(__args)...);
+    }
+
+  /// std::hash specialization for __shared_ptr.
+  template<typename _Tp, _Lock_policy _Lp>
+    struct hash<__shared_ptr<_Tp, _Lp>>
+    : public std::unary_function<__shared_ptr<_Tp, _Lp>, size_t>
+    {
+      size_t
+      operator()(const __shared_ptr<_Tp, _Lp>& __s) const noexcept
+      { return std::hash<_Tp*>()(__s.get()); }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _SHARED_PTR_BASE_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/slice_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/slice_array.h
new file mode 100644
index 0000000..3afae22
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/slice_array.h
@@ -0,0 +1,275 @@
+// The template and inlines for the -*- C++ -*- slice_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2009,
+// 2010  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/slice_array.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_VERSION
+} // namespace
+
+#endif /* _SLICE_ARRAY_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/sstream.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/sstream.tcc
new file mode 100644
index 0000000..89b9a54
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/sstream.tcc
@@ -0,0 +1,290 @@
+// String based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/sstream.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{sstream}
+ */
+
+//
+// ISO C++ 14882: 27.7  String-based streams
+//
+
+#ifndef _SSTREAM_TCC
+#define _SSTREAM_TCC 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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->setg(this->eback(), this->eback() + __newoffi,
+			 this->egptr());
+	      __ret = pos_type(__newoffi);
+	    }
+	  if ((__testout || __testboth)
+	      && __newoffo >= 0
+	      && this->egptr() - __beg >= __newoffo)
+	    {
+	      _M_pbump(this->pbase(), this->epptr(), __newoffo);
+	      __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->setg(this->eback(), this->eback() + __pos,
+			   this->egptr());
+	      if (__testout)
+		_M_pbump(this->pbase(), this->epptr(), __pos);
+	      __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)
+	{
+	  _M_pbump(__base, __endp, __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);
+	}
+    }
+
+  template <class _CharT, class _Traits, class _Alloc>
+    void
+    basic_stringbuf<_CharT, _Traits, _Alloc>::
+    _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off)
+    {
+      this->setp(__pbeg, __pend);
+      while (__off > __gnu_cxx::__numeric_traits<int>::__max)
+	{
+	  this->pbump(__gnu_cxx::__numeric_traits<int>::__max);
+	  __off -= __gnu_cxx::__numeric_traits<int>::__max;
+	}
+      this->pbump(__off);
+    }
+
+  // Inhibit implicit instantiations for required instantiations,
+  // which are defined via explicit instantiations elsewhere.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algo.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algo.h
new file mode 100644
index 0000000..1d6026a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algo.h
@@ -0,0 +1,6320 @@
+// Algorithm implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_algo.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{algorithm}
+ */
+
+#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
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <random>     // for std::uniform_int_distribution
+#include <functional> // for std::bind
+#endif
+
+// See concept_check.h for the __glibcxx_*_requires macros.
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// Swaps the median value of *__a, *__b and *__c to *__a
+  template<typename _Iterator>
+    void
+    __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_LessThanComparableConcept<
+	    typename iterator_traits<_Iterator>::value_type>)
+
+      if (*__a < *__b)
+	{
+	  if (*__b < *__c)
+	    std::iter_swap(__a, __b);
+	  else if (*__a < *__c)
+	    std::iter_swap(__a, __c);
+	}
+      else if (*__a < *__c)
+	return;
+      else if (*__b < *__c)
+	std::iter_swap(__a, __c);
+      else
+	std::iter_swap(__a, __b);
+    }
+
+  /// Swaps the median value of *__a, *__b and *__c under __comp to *__a
+  template<typename _Iterator, typename _Compare>
+    void
+    __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c,
+			_Compare __comp)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
+	    typename iterator_traits<_Iterator>::value_type,
+	    typename iterator_traits<_Iterator>::value_type>)
+
+      if (__comp(*__a, *__b))
+	{
+	  if (__comp(*__b, *__c))
+	    std::iter_swap(__a, __b);
+	  else if (__comp(*__a, *__c))
+	    std::iter_swap(__a, __c);
+	}
+      else if (__comp(*__a, *__c))
+	return;
+      else if (__comp(*__b, *__c))
+	std::iter_swap(__a, __c);
+      else
+	std::iter_swap(__a, __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
+
+// Local modification: if __google_stl_debug_compare is defined to
+// non-zero value, check sort predicate for strict weak ordering.
+// Google ref b/1731200.
+#if __google_stl_debug_compare
+  template<typename _Compare>
+  struct _CheckedCompare {
+    _Compare _M_compare;
+
+    _CheckedCompare(const _Compare & __comp): _M_compare(__comp) { }
+
+    template <typename _Tp>
+    bool operator()(const _Tp& __x, const _Tp& __y) {
+      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.
+    template <typename _Tp1, typename _Tp2>
+    bool operator()(const _Tp1& __x, const _Tp2& __y) {
+      return _M_compare(__x, __y);
+    }
+  };
+# define __CheckedCompare(__comp) _CheckedCompare<__typeof__(__comp)>(__comp)
+#else
+# define __CheckedCompare(__comp) __comp
+#endif
+
+  /**
+   *  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_A::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_A::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_A::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_A::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_A::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_A::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_A::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_A::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_A::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_A::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;
+
+      _Distance __n = __last   - __first;
+      _Distance __k = __middle - __first;
+
+      if (__k == __n - __k)
+	{
+	  std::swap_ranges(__first, __middle, __middle);
+	  return;
+	}
+
+      _RandomAccessIterator __p = __first;
+
+      for (;;)
+	{
+	  if (__k < __n - __k)
+	    {
+	      if (__is_pod(_ValueType) && __k == 1)
+		{
+		  _ValueType __t = _GLIBCXX_MOVE(*__p);
+		  _GLIBCXX_MOVE3(__p + 1, __p + __n, __p);
+		  *(__p + __n - 1) = _GLIBCXX_MOVE(__t);
+		  return;
+		}
+	      _RandomAccessIterator __q = __p + __k;
+	      for (_Distance __i = 0; __i < __n - __k; ++ __i)
+		{
+		  std::iter_swap(__p, __q);
+		  ++__p;
+		  ++__q;
+		}
+	      __n %= __k;
+	      if (__n == 0)
+		return;
+	      std::swap(__n, __k);
+	      __k = __n - __k;
+	    }
+	  else
+	    {
+	      __k = __n - __k;
+	      if (__is_pod(_ValueType) && __k == 1)
+		{
+		  _ValueType __t = _GLIBCXX_MOVE(*(__p + __n - 1));
+		  _GLIBCXX_MOVE_BACKWARD3(__p, __p + __n - 1, __p + __n);
+		  *__p = _GLIBCXX_MOVE(__t);
+		  return;
+		}
+	      _RandomAccessIterator __q = __p + __n;
+	      __p = __q - __k;
+	      for (_Distance __i = 0; __i < __n - __k; ++ __i)
+		{
+		  --__p;
+		  --__q;
+		  std::iter_swap(__p, __q);
+		}
+	      __n %= __k;
+	      if (__n == 0)
+		return;
+	      std::swap(__n, __k);
+	    }
+	}
+    }
+
+  /**
+   *  @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 = _GLIBCXX_MOVE(*__first);
+		++__result1;
+	      }
+	    else
+	      {
+		*__result2 = _GLIBCXX_MOVE(*__first);
+		++__result2;
+	      }
+	  _GLIBCXX_MOVE3(__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>
+    void
+    __unguarded_linear_insert(_RandomAccessIterator __last)
+    {
+      typename iterator_traits<_RandomAccessIterator>::value_type
+	__val = _GLIBCXX_MOVE(*__last);
+      _RandomAccessIterator __next = __last;
+      --__next;
+      while (__val < *__next)
+	{
+	  *__last = _GLIBCXX_MOVE(*__next);
+	  __last = __next;
+	  --__next;
+	}
+      *__last = _GLIBCXX_MOVE(__val);
+    }
+
+  /// This is a helper function for the sort routine.
+  template<typename _RandomAccessIterator, typename _Compare>
+    void
+    __unguarded_linear_insert(_RandomAccessIterator __last,
+			      _Compare __comp)
+    {
+      typename iterator_traits<_RandomAccessIterator>::value_type
+	__val = _GLIBCXX_MOVE(*__last);
+      _RandomAccessIterator __next = __last;
+      --__next;
+      while (__comp(__val, *__next))
+	{
+	  *__last = _GLIBCXX_MOVE(*__next);
+	  __last = __next;
+	  --__next;
+	}
+      *__last = _GLIBCXX_MOVE(__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)
+	{
+	  if (*__i < *__first)
+	    {
+	      typename iterator_traits<_RandomAccessIterator>::value_type
+		__val = _GLIBCXX_MOVE(*__i);
+	      _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1);
+	      *__first = _GLIBCXX_MOVE(__val);
+	    }
+	  else
+	    std::__unguarded_linear_insert(__i);
+	}
+    }
+
+  /// 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)
+	{
+	  if (__comp(*__i, *__first))
+	    {
+	      typename iterator_traits<_RandomAccessIterator>::value_type
+		__val = _GLIBCXX_MOVE(*__i);
+	      _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1);
+	      *__first = _GLIBCXX_MOVE(__val);
+	    }
+	  else
+	    std::__unguarded_linear_insert(__i, __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);
+    }
+
+  /// 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, __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, const _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,
+			  const _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...
+  template<typename _RandomAccessIterator>
+    inline _RandomAccessIterator
+    __unguarded_partition_pivot(_RandomAccessIterator __first,
+				_RandomAccessIterator __last)
+    {
+      _RandomAccessIterator __mid = __first + (__last - __first) / 2;
+      std::__move_median_first(__first, __mid, (__last - 1));
+      return std::__unguarded_partition(__first + 1, __last, *__first);
+    }
+
+
+  /// This is a helper function...
+  template<typename _RandomAccessIterator, typename _Compare>
+    inline _RandomAccessIterator
+    __unguarded_partition_pivot(_RandomAccessIterator __first,
+				_RandomAccessIterator __last, _Compare __comp)
+    {
+      _RandomAccessIterator __mid = __first + (__last - __first) / 2;
+      std::__move_median_first(__first, __mid, (__last - 1), __comp);
+      return std::__unguarded_partition(__first + 1, __last, *__first, __comp);
+    }
+
+  /// This is a helper function for the sort routine.
+  template<typename _RandomAccessIterator, typename _Size>
+    void
+    __introsort_loop(_RandomAccessIterator __first,
+		     _RandomAccessIterator __last,
+		     _Size __depth_limit)
+    {
+      while (__last - __first > int(_S_threshold))
+	{
+	  if (__depth_limit == 0)
+	    {
+	      _GLIBCXX_STD_A::partial_sort(__first, __last, __last);
+	      return;
+	    }
+	  --__depth_limit;
+	  _RandomAccessIterator __cut =
+	    std::__unguarded_partition_pivot(__first, __last);
+	  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)
+    {
+      while (__last - __first > int(_S_threshold))
+	{
+	  if (__depth_limit == 0)
+	    {
+	      _GLIBCXX_STD_A::partial_sort(__first, __last, __last, __comp);
+	      return;
+	    }
+	  --__depth_limit;
+	  _RandomAccessIterator __cut =
+	    std::__unguarded_partition_pivot(__first, __last, __comp);
+	  std::__introsort_loop(__cut, __last, __depth_limit, __comp);
+	  __last = __cut;
+	}
+    }
+
+  // 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_pivot(__first, __last);
+	  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_pivot(__first, __last, __comp);
+	  if (__cut <= __nth)
+	    __first = __cut;
+	  else
+	    __last = __cut;
+	}
+      std::__insertion_sort(__first, __last, __comp);
+    }
+
+  // nth_element
+
+  // lower_bound moved to stl_algobase.h
+
+  /**
+   *  @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 <em>not less
+   *           than</em> @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);
+
+      while (__len > 0)
+	{
+	  _DistanceType __half = __len >> 1;
+	  _ForwardIterator __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);
+
+      while (__len > 0)
+	{
+	  _DistanceType __half = __len >> 1;
+	  _ForwardIterator __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);
+
+      while (__len > 0)
+	{
+	  _DistanceType __half = __len >> 1;
+	  _ForwardIterator __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);
+ 
+      while (__len > 0)
+	{
+	  _DistanceType __half = __len >> 1;
+	  _ForwardIterator __middle = __first;
+	  std::advance(__middle, __half);
+	  if (*__middle < __val)
+	    {
+	      __first = __middle;
+	      ++__first;
+	      __len = __len - __half - 1;
+	    }
+	  else if (__val < *__middle)
+	    __len = __half;
+	  else
+	    {
+	      _ForwardIterator __left = std::lower_bound(__first, __middle,
+							 __val);
+	      std::advance(__first, __len);
+	      _ForwardIterator __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);
+
+      while (__len > 0)
+	{
+	  _DistanceType __half = __len >> 1;
+	  _ForwardIterator __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
+	    {
+	      _ForwardIterator __left = std::lower_bound(__first, __middle,
+							 __val, __comp);
+	      std::advance(__first, __len);
+	      _ForwardIterator __right = std::upper_bound(++__middle, __first,
+							  __val, __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, __comp);
+      return __i != __last && !bool(__CheckedCompare(__comp)(__val, *__i));
+    }
+
+  // merge
+
+  /// This is a helper function for the __merge_adaptive routines.
+  template<typename _InputIterator1, typename _InputIterator2,
+	   typename _OutputIterator>
+    void
+    __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1,
+			  _InputIterator2 __first2, _InputIterator2 __last2,
+			  _OutputIterator __result)
+    {
+      while (__first1 != __last1 && __first2 != __last2)
+	{
+	  if (*__first2 < *__first1)
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first2);
+	      ++__first2;
+	    }
+	  else
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first1);
+	      ++__first1;
+	    }
+	  ++__result;
+	}
+      if (__first1 != __last1)
+	_GLIBCXX_MOVE3(__first1, __last1, __result);
+    }
+
+  /// This is a helper function for the __merge_adaptive routines.
+  template<typename _InputIterator1, typename _InputIterator2,
+	   typename _OutputIterator, typename _Compare>
+    void
+    __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1,
+			  _InputIterator2 __first2, _InputIterator2 __last2,
+			  _OutputIterator __result, _Compare __comp)
+    {
+      while (__first1 != __last1 && __first2 != __last2)
+	{
+	  if (__comp(*__first2, *__first1))
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first2);
+	      ++__first2;
+	    }
+	  else
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first1);
+	      ++__first1;
+	    }
+	  ++__result;
+	}
+      if (__first1 != __last1)
+	_GLIBCXX_MOVE3(__first1, __last1, __result);
+    }
+
+  /// This is a helper function for the __merge_adaptive routines.
+  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
+	   typename _BidirectionalIterator3>
+    void
+    __move_merge_adaptive_backward(_BidirectionalIterator1 __first1,
+				   _BidirectionalIterator1 __last1,
+				   _BidirectionalIterator2 __first2,
+				   _BidirectionalIterator2 __last2,
+				   _BidirectionalIterator3 __result)
+    {
+      if (__first1 == __last1)
+	{
+	  _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result);
+	  return;
+	}
+      else if (__first2 == __last2)
+	return;
+
+      --__last1;
+      --__last2;
+      while (true)
+	{
+	  if (*__last2 < *__last1)
+	    {
+	      *--__result = _GLIBCXX_MOVE(*__last1);
+	      if (__first1 == __last1)
+		{
+		  _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result);
+		  return;
+		}
+	      --__last1;
+	    }
+	  else
+	    {
+	      *--__result = _GLIBCXX_MOVE(*__last2);
+	      if (__first2 == __last2)
+		return;
+	      --__last2;
+	    }
+	}
+    }
+
+  /// This is a helper function for the __merge_adaptive routines.
+  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
+	   typename _BidirectionalIterator3, typename _Compare>
+    void
+    __move_merge_adaptive_backward(_BidirectionalIterator1 __first1,
+				   _BidirectionalIterator1 __last1,
+				   _BidirectionalIterator2 __first2,
+				   _BidirectionalIterator2 __last2,
+				   _BidirectionalIterator3 __result,
+				   _Compare __comp)
+    {
+      if (__first1 == __last1)
+	{
+	  _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result);
+	  return;
+	}
+      else if (__first2 == __last2)
+	return;
+
+      --__last1;
+      --__last2;
+      while (true)
+	{
+	  if (__comp(*__last2, *__last1))
+	    {
+	      *--__result = _GLIBCXX_MOVE(*__last1);
+	      if (__first1 == __last1)
+		{
+		  _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result);
+		  return;
+		}
+	      --__last1;
+	    }
+	  else
+	    {
+	      *--__result = _GLIBCXX_MOVE(*__last2);
+	      if (__first2 == __last2)
+		return;
+	      --__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)
+	{
+	  if (__len2)
+	    {
+	      __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer);
+	      _GLIBCXX_MOVE_BACKWARD3(__first, __middle, __last);
+	      return _GLIBCXX_MOVE3(__buffer, __buffer_end, __first);
+	    }
+	  else
+	    return __first;
+	}
+      else if (__len1 <= __buffer_size)
+	{
+	  if (__len1)
+	    {
+	      __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer);
+	      _GLIBCXX_MOVE3(__middle, __last, __first);
+	      return _GLIBCXX_MOVE_BACKWARD3(__buffer, __buffer_end, __last);
+	    }
+	  else
+	    return __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 = _GLIBCXX_MOVE3(__first, __middle, __buffer);
+	  std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last,
+				     __first);
+	}
+      else if (__len2 <= __buffer_size)
+	{
+	  _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer);
+	  std::__move_merge_adaptive_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 = _GLIBCXX_MOVE3(__first, __middle, __buffer);
+	  std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last,
+				     __first, __comp);
+	}
+      else if (__len2 <= __buffer_size)
+	{
+	  _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer);
+	  std::__move_merge_adaptive_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));
+    }
+
+
+  /// This is a helper function for the __merge_sort_loop routines.
+  template<typename _InputIterator1, typename _InputIterator2,
+	   typename _OutputIterator>
+    _OutputIterator
+    __move_merge(_InputIterator1 __first1, _InputIterator1 __last1,
+		 _InputIterator2 __first2, _InputIterator2 __last2,
+		 _OutputIterator __result)
+    {
+      while (__first1 != __last1 && __first2 != __last2)
+	{
+	  if (*__first2 < *__first1)
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first2);
+	      ++__first2;
+	    }
+	  else
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first1);
+	      ++__first1;
+	    }
+	  ++__result;
+	}
+      return _GLIBCXX_MOVE3(__first2, __last2,
+			    _GLIBCXX_MOVE3(__first1, __last1,
+					   __result));
+    }
+
+  /// This is a helper function for the __merge_sort_loop routines.
+  template<typename _InputIterator1, typename _InputIterator2,
+	   typename _OutputIterator, typename _Compare>
+    _OutputIterator
+    __move_merge(_InputIterator1 __first1, _InputIterator1 __last1,
+		 _InputIterator2 __first2, _InputIterator2 __last2,
+		 _OutputIterator __result, _Compare __comp)
+    {
+      while (__first1 != __last1 && __first2 != __last2)
+	{
+	  if (__comp(*__first2, *__first1))
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first2);
+	      ++__first2;
+	    }
+	  else
+	    {
+	      *__result = _GLIBCXX_MOVE(*__first1);
+	      ++__first1;
+	    }
+	  ++__result;
+	}
+      return _GLIBCXX_MOVE3(__first2, __last2,
+			    _GLIBCXX_MOVE3(__first1, __last1,
+					   __result));
+    }
+
+  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 = std::__move_merge(__first, __first + __step_size,
+				       __first + __step_size,
+				       __first + __two_step, __result);
+	  __first += __two_step;
+	}
+
+      __step_size = std::min(_Distance(__last - __first), __step_size);
+      std::__move_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 = std::__move_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);
+
+      std::__move_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 @a 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 @a 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 @a 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
+   *  @a 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 @a 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 @a 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 @a 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
+   *  @a 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 + DR 915.
+  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);
+    }
+
+  /**
+   *  @brief  Checks whether a permutaion of the second sequence is equal
+   *          to the first sequence.
+   *  @ingroup non_mutating_algorithms
+   *  @param  first1  Start of first range.
+   *  @param  last1   End of first range.
+   *  @param  first2  Start of second range.
+   *  @return true if there exists a permutation of the elements in the range
+   *          [first2, first2 + (last1 - first1)), beginning with 
+   *          ForwardIterator2 begin, such that equal(first1, last1, begin)
+   *          returns true; otherwise, returns false.
+  */
+  template<typename _ForwardIterator1, typename _ForwardIterator2>
+    bool
+    is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+		   _ForwardIterator2 __first2)
+    {
+      // Efficiently compare identical prefixes:  O(N) if sequences
+      // have the same elements in the same order.
+      for (; __first1 != __last1; ++__first1, ++__first2)
+	if (!(*__first1 == *__first2))
+	  break;
+
+      if (__first1 == __last1)
+	return true;
+
+      // Establish __last2 assuming equal ranges by iterating over the
+      // rest of the list.
+      _ForwardIterator2 __last2 = __first2;
+      std::advance(__last2, std::distance(__first1, __last1));
+      for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan)
+	{
+	  if (__scan != _GLIBCXX_STD_A::find(__first1, __scan, *__scan))
+	    continue; // We've seen this one before.
+
+	  auto __matches = std::count(__first2, __last2, *__scan);
+	  if (0 == __matches
+	      || std::count(__scan, __last1, *__scan) != __matches)
+	    return false;
+	}
+      return true;
+    }
+
+  /**
+   *  @brief  Checks whether a permutation of the second sequence is equal
+   *          to the first sequence.
+   *  @ingroup non_mutating_algorithms
+   *  @param  first1  Start of first range.
+   *  @param  last1   End of first range.
+   *  @param  first2  Start of second range.
+   *  @param  pred    A binary predicate.
+   *  @return true if there exists a permutation of the elements in the range
+   *          [first2, first2 + (last1 - first1)), beginning with 
+   *          ForwardIterator2 begin, such that equal(first1, last1, begin,
+   *          pred) returns true; otherwise, returns false.
+  */
+  template<typename _ForwardIterator1, typename _ForwardIterator2,
+	   typename _BinaryPredicate>
+    bool
+    is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+		   _ForwardIterator2 __first2, _BinaryPredicate __pred)
+    {
+      // Efficiently compare identical prefixes:  O(N) if sequences
+      // have the same elements in the same order.
+      for (; __first1 != __last1; ++__first1, ++__first2)
+	if (!bool(__pred(*__first1, *__first2)))
+	  break;
+
+      if (__first1 == __last1)
+	return true;
+
+      // Establish __last2 assuming equal ranges by iterating over the
+      // rest of the list.
+      _ForwardIterator2 __last2 = __first2;
+      std::advance(__last2, std::distance(__first1, __last1));
+      for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan)
+	{
+	  using std::placeholders::_1;
+
+	  if (__scan != _GLIBCXX_STD_A::find_if(__first1, __scan,
+						std::bind(__pred, _1, *__scan)))
+	    continue; // We've seen this one before.
+	  
+	  auto __matches = std::count_if(__first2, __last2,
+					 std::bind(__pred, _1, *__scan));
+	  if (0 == __matches
+	      || std::count_if(__scan, __last1,
+			       std::bind(__pred, _1, *__scan)) != __matches)
+	    return false;
+	}
+      return true;
+    }
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+  /**
+   *  @brief Shuffle the elements of a sequence using a uniform random
+   *         number generator.
+   *  @ingroup mutating_algorithms
+   *  @param  first   A forward iterator.
+   *  @param  last    A forward iterator.
+   *  @param  g       A UniformRandomNumberGenerator (26.5.1.3).
+   *  @return  Nothing.
+   *
+   *  Reorders the elements in the range @p [first,last) using @p g to
+   *  provide random numbers.
+  */
+  template<typename _RandomAccessIterator,
+	   typename _UniformRandomNumberGenerator>
+    void
+    shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
+	    _UniformRandomNumberGenerator&& __g)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+	    _RandomAccessIterator>)
+      __glibcxx_requires_valid_range(__first, __last);
+
+      if (__first == __last)
+	return;
+
+      typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+	_DistanceType;
+
+      typedef typename std::make_unsigned<_DistanceType>::type __ud_type;
+      typedef typename std::uniform_int_distribution<__ud_type> __distr_type;
+      typedef typename __distr_type::param_type __p_type;
+      __distr_type __d;
+
+      for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+	std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first)));
+    }
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_END_NAMESPACE_VERSION
+
+_GLIBCXX_BEGIN_NAMESPACE_ALGO
+
+  /**
+   *  @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 (std::move(@p f) in C++0x).
+   *
+   *  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 _GLIBCXX_MOVE(__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_A::find(__first1, __last1, *__first2);
+
+      // General case.
+      _ForwardIterator2 __p;
+      _ForwardIterator1 __current = __first1;
+
+      for (;;)
+	{
+	  __first1 = _GLIBCXX_STD_A::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_A::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).
+   *
+   *  _GLIBCXX_RESOLVE_LIB_DEFECTS
+   *  DR 865. More algorithms that throw away information
+  */
+  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 (__decltype(__n + 0) __niter = __n;
+	   __niter > 0; --__niter, ++__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,
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+		   _RandomNumberGenerator&& __rand)
+#else
+		   _RandomNumberGenerator& __rand)
+#endif
+    {
+      // 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 <em>not less
+   *                  than</em> @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_NAMESPACE_ALGO
+} // namespace std
+
+#endif /* _STL_ALGO_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algobase.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algobase.h
new file mode 100644
index 0000000..aecdcb9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algobase.h
@@ -0,0 +1,1211 @@
+// Core algorithmic facilities -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_algobase.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{algorithm}
+ */
+
+#ifndef _STL_ALGOBASE_H
+#define _STL_ALGOBASE_H 1
+
+#include <bits/c++config.h>
+#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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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>
+    struct _Niter_base
+    : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value>
+    { };
+
+  template<typename _Iterator>
+    inline typename _Niter_base<_Iterator>::iterator_type
+    __niter_base(_Iterator __it)
+    { return std::_Niter_base<_Iterator>::_S_base(__it); }
+
+  // Likewise, for move_iterator.
+  template<typename _Iterator>
+    struct _Miter_base
+    : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value>
+    { };
+
+  template<typename _Iterator>
+    inline typename _Miter_base<_Iterator>::iterator_type
+    __miter_base(_Iterator __it)
+    { return std::_Miter_base<_Iterator>::_S_base(__it); }
+
+  // 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)
+        {
+	  const ptrdiff_t _Num = __last - __first;
+	  if (_Num)
+	    __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
+	  return __result + _Num;
+	}
+    };
+
+  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_trivial(_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(__first),
+					     std::__niter_base(__last),
+					     std::__niter_base(__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(__first), std::__miter_base(__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(__first),
+				       std::__miter_base(__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;
+	  if (_Num)
+	    __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_trivial(_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(__first), std::__niter_base(__last),
+		   std::__niter_base(__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(__first), std::__miter_base(__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(__first),
+						std::__miter_base(__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(__first), std::__niter_base(__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 (__decltype(__n + 0) __niter = __n;
+	   __niter > 0; --__niter, ++__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 (__decltype(__n + 0) __niter = __n;
+	   __niter > 0; --__niter, ++__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.
+   *
+   *  _GLIBCXX_RESOLVE_LIB_DEFECTS
+   *  DR 865. More algorithms that throw away information
+  */
+  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(__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);
+    }
+
+  /**
+   *  @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 <em>not less
+   *                  than</em> @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);
+
+      while (__len > 0)
+	{
+	  _DistanceType __half = __len >> 1;
+	  _ForwardIterator __middle = __first;
+	  std::advance(__middle, __half);
+	  if (*__middle < __val)
+	    {
+	      __first = __middle;
+	      ++__first;
+	      __len = __len - __half - 1;
+	    }
+	  else
+	    __len = __half;
+	}
+      return __first;
+    }
+
+  /// This is a helper function for the sort routines and for random.tcc.
+  //  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); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+
+_GLIBCXX_BEGIN_NAMESPACE_ALGO
+
+  /**
+   *  @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(__first1),
+			      std::__niter_base(__last1),
+			      std::__niter_base(__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 @b 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.
+   *
+   *  <em>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.</em>
+   *  (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(__first1),
+						std::__niter_base(__last1),
+						std::__niter_base(__first2),
+						std::__niter_base(__last2));
+    }
+
+  /**
+   *  @brief Performs @b 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_NAMESPACE_ALGO
+} // namespace std
+
+// 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_bvector.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_bvector.h
new file mode 100644
index 0000000..5bf10d9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_bvector.h
@@ -0,0 +1,1061 @@
+// vector<bool> specialization -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_bvector.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{vector}
+ */
+
+#ifndef _STL_BVECTOR_H
+#define _STL_BVECTOR_H 1
+
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  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_NAMESPACE_CONTAINER
+} // namespace std
+
+// Declare a partial specialization of vector<T, Alloc>.
+#include <bits/stl_vector.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename> friend class hash;
+#endif
+
+  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::move(__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 1204.
+      // 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
+    swap(vector& __x)
+    {
+      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)
+    {
+      if (__first != __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);
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    void
+    shrink_to_fit()
+    { std::__shrink_to_fit<vector>::_S_do_it(*this); }
+#endif
+
+    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_NAMESPACE_CONTAINER
+} // namespace std
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // DR 1182.
+  /// std::hash specialization for vector<bool>.
+  template<typename _Alloc>
+    struct hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>
+    : public __hash_base<size_t, _GLIBCXX_STD_C::vector<bool, _Alloc>>
+    {
+      size_t
+      operator()(const _GLIBCXX_STD_C::vector<bool, _Alloc>&) const noexcept;
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}// namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_construct.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_construct.h
new file mode 100644
index 0000000..2efba93
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_construct.h
@@ -0,0 +1,160 @@
+// nonstandard construct and destroy functions -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_construct.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _STL_CONSTRUCT_H
+#define _STL_CONSTRUCT_H 1
+
+#include <new>
+#include <bits/move.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * Constructs an object in existing memory by invoking an allocated
+   * object's constructor with an initializer.
+   */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _T1, typename... _Args>
+    inline void
+    _Construct(_T1* __p, _Args&&... __args)
+    { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
+#else
+  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);
+    }
+#endif
+
+  /**
+   * Destroy the object pointed to by a pointer type.
+   */
+  template<typename _Tp>
+    inline void
+    _Destroy(_Tp* __pointer)
+    { __pointer->~_Tp(); }
+
+  template<bool>
+    struct _Destroy_aux
+    {
+      template<typename _ForwardIterator>
+        static void
+        __destroy(_ForwardIterator __first, _ForwardIterator __last)
+	{
+	  for (; __first != __last; ++__first)
+	    std::_Destroy(std::__addressof(*__first));
+	}
+    };
+
+  template<>
+    struct _Destroy_aux<true>
+    {
+      template<typename _ForwardIterator>
+        static void
+        __destroy(_ForwardIterator, _ForwardIterator) { }
+    };
+
+  /**
+   * 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;
+      std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
+	__destroy(__first, __last);
+    }
+
+  /**
+   * 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(std::__addressof(*__first));
+    }
+
+  template<typename _ForwardIterator, typename _Tp>
+    inline void
+    _Destroy(_ForwardIterator __first, _ForwardIterator __last,
+	     allocator<_Tp>&)
+    {
+      _Destroy(__first, __last);
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_CONSTRUCT_H */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_deque.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_deque.h
new file mode 100644
index 0000000..0d9b5b4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_deque.h
@@ -0,0 +1,1979 @@
+// Deque implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_deque.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{deque}
+ */
+
+#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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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 @b 512 is tunable (and no other code needs to
+   *  change), but no investigation has been done since inheriting the
+   *  SGI code.  Touch _GLIBCXX_DEQUE_BUF_SIZE only if you know what
+   *  you are doing, however: changing it breaks the binary
+   *  compatibility!!
+  */
+
+#ifndef _GLIBCXX_DEQUE_BUF_SIZE
+#define _GLIBCXX_DEQUE_BUF_SIZE 512
+#endif
+
+  inline size_t
+  __deque_buf_size(size_t __size)
+  { return (__size < _GLIBCXX_DEQUE_BUF_SIZE
+	    ? size_t(_GLIBCXX_DEQUE_BUF_SIZE / __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*>&,
+	 const _Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&);
+
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+	 _Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*>);
+
+  template<typename _Tp>
+    inline _Deque_iterator<_Tp, _Tp&, _Tp*>
+    copy(_Deque_iterator<_Tp, _Tp&, _Tp*> __first,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*> __last,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    { return std::copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first),
+		       _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last),
+		       __result); }
+
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+		  _Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*>);
+
+  template<typename _Tp>
+    inline _Deque_iterator<_Tp, _Tp&, _Tp*>
+    copy_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*> __last,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    { return std::copy_backward(_Deque_iterator<_Tp,
+				const _Tp&, const _Tp*>(__first),
+				_Deque_iterator<_Tp,
+				const _Tp&, const _Tp*>(__last),
+				__result); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+	 _Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*>);
+
+  template<typename _Tp>
+    inline _Deque_iterator<_Tp, _Tp&, _Tp*>
+    move(_Deque_iterator<_Tp, _Tp&, _Tp*> __first,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*> __last,
+	 _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    { return std::move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first),
+		       _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last),
+		       __result); }
+
+  template<typename _Tp>
+    _Deque_iterator<_Tp, _Tp&, _Tp*>
+    move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+		  _Deque_iterator<_Tp, const _Tp&, const _Tp*>,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*>);
+
+  template<typename _Tp>
+    inline _Deque_iterator<_Tp, _Tp&, _Tp*>
+    move_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*> __last,
+		  _Deque_iterator<_Tp, _Tp&, _Tp*> __result)
+    { return std::move_backward(_Deque_iterator<_Tp,
+				const _Tp&, const _Tp*>(__first),
+				_Deque_iterator<_Tp,
+				const _Tp&, const _Tp*>(__last),
+				__result); }
+#endif
+
+  /**
+   *  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(size_t __num_elements)
+      : _M_impl()
+      { _M_initialize_map(__num_elements); }
+
+      _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-@anodes.  (The name %map has nothing to do with the
+   *  std::map class, and @b nodes should not be confused with
+   *  std::list's usage of @a node.)
+   *
+   *  A @a node has no specific type name as such, but it is referred
+   *  to as @a 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
+   *  @a 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 @a 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 @b aware of the discontiguous
+   *  storage!
+   *
+   *  The memory setup and layout occurs in the parent, _Base, and the iterator
+   *  class is entirely responsible for @a 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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Creates a %deque with default constructed elements.
+       *  @param  n  The number of elements to initially create.
+       *
+       *  This constructor fills the %deque with @a n default
+       *  constructed elements.
+       */
+      explicit
+      deque(size_type __n)
+      : _Base(__n)
+      { _M_default_initialize(); }
+
+      /**
+       *  @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.
+       */
+      deque(size_type __n, const value_type& __value,
+	    const allocator_type& __a = allocator_type())
+      : _Base(__a, __n)
+      { _M_fill_initialize(__value); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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::move(__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 1204.
+	// 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(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Resizes the %deque to the specified number of elements.
+       *  @param  new_size  Number of elements the %deque should contain.
+       *
+       *  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
+       *  default constructed elements are appended.
+       */
+      void
+      resize(size_type __new_size)
+      {
+	const size_type __len = size();
+	if (__new_size > __len)
+	  _M_default_append(__new_size - __len);
+	else if (__new_size < __len)
+	  _M_erase_at_end(this->_M_impl._M_start
+			  + difference_type(__new_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, const value_type& __x)
+      {
+	const size_type __len = size();
+	if (__new_size > __len)
+	  insert(this->_M_impl._M_finish, __new_size - __len, __x);
+	else if (__new_size < __len)
+	  _M_erase_at_end(this->_M_impl._M_start
+			  + difference_type(__new_size));
+      }
+#else
+      /**
+       *  @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)
+	  insert(this->_M_impl._M_finish, __new_size - __len, __x);
+	else if (__new_size < __len)
+	  _M_erase_at_end(this->_M_impl._M_start
+			  + difference_type(__new_size));
+      }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**  A non-binding request to reduce memory use.  */
+      void
+      shrink_to_fit()
+      { std::__shrink_to_fit<deque>::_S_do_it(*this); }
+#endif
+
+      /**
+       *  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 <em>list insert</em>.
+       */
+      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 <em>range insert</em>.
+       */
+      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
+      swap(deque& __x)
+      {
+	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);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // called by deque(n).
+      void
+      _M_default_initialize();
+#endif
+
+      // 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;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // Called by resize(sz).
+      void
+      _M_default_append(size_type __n);
+#endif
+
+      //@{
+      /// 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); }
+
+#undef _GLIBCXX_DEQUE_BUF_SIZE
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _STL_DEQUE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_function.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_function.h
new file mode 100644
index 0000000..88655fc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_function.h
@@ -0,0 +1,734 @@
+// Functor implementations -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_function.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{functional}
+ */
+
+#ifndef _STL_FUNCTION_H
+#define _STL_FUNCTION_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 @a 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
+    {
+      /// @c argument_type is the type of the argument
+      typedef _Arg 	argument_type;   
+
+      /// @c result_type is the return type
+      typedef _Result 	result_type;  
+    };
+
+  /**
+   *  This is one of the @link functors functor base classes@endlink.
+   */
+  template<typename _Arg1, typename _Arg2, typename _Result>
+    struct binary_function
+    {
+      /// @c first_argument_type is the type of the first argument
+      typedef _Arg1 	first_argument_type; 
+
+      /// @c second_argument_type is the type of the second argument
+      typedef _Arg2 	second_argument_type;
+
+      /// @c result_type is the return type
+      typedef _Result 	result_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
+   *  <code>!(v[i] > 3)</code> 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; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair2>
+        typename _Pair2::first_type&
+        operator()(_Pair2& __x) const
+        { return __x.first; }
+
+      template<typename _Pair2>
+        const typename _Pair2::first_type&
+        operator()(const _Pair2& __x) const
+        { return __x.first; }
+#endif
+    };
+
+  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_VERSION
+} // namespace
+
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED
+# include <backward/binders.h>
+#endif
+
+#endif /* _STL_FUNCTION_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_heap.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_heap.h
new file mode 100644
index 0000000..b00fc69
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_heap.h
@@ -0,0 +1,581 @@
+// Heap implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_heap.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{queue}
+ */
+
+#ifndef _STL_HEAP_H
+#define _STL_HEAP_H 1
+
+#include <debug/debug.h>
+#include <bits/move.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup heap_algorithms Heap
+   * @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_VERSION
+} // namespace
+
+#endif /* _STL_HEAP_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator.h
new file mode 100644
index 0000000..b23107d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator.h
@@ -0,0 +1,1131 @@
+// Iterators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_iterator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ *
+ *  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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
+  // 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
+   *
+   *  <em>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.</em> [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;
+
+      typedef iterator_traits<_Iterator>		__traits_type;
+
+    public:
+      typedef _Iterator					iterator_type;
+      typedef typename __traits_type::difference_type	difference_type;
+      typedef typename __traits_type::pointer		pointer;
+      typedef typename __traits_type::reference		reference;
+
+      /**
+       *  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 @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.
+      */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+      back_insert_iterator&
+      operator=(typename _Container::const_reference __value)
+      {
+	container->push_back(__value);
+	return *this;
+      }
+#else
+      back_insert_iterator&
+      operator=(const typename _Container::value_type& __value)
+      {
+	container->push_back(__value);
+	return *this;
+      }
+
+      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 @a move.)
+      back_insert_iterator&
+      operator++()
+      { return *this; }
+
+      /// Simply returns *this.  (This %iterator does not @a 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 @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.
+      */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+      front_insert_iterator&
+      operator=(typename _Container::const_reference __value)
+      {
+	container->push_front(__value);
+	return *this;
+      }
+#else
+      front_insert_iterator&
+      operator=(const typename _Container::value_type& __value)
+      {
+	container->push_front(__value);
+	return *this;
+      }
+
+      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 @a move.)
+      front_insert_iterator&
+      operator++()
+      { return *this; }
+
+      /// Simply returns *this.  (This %iterator does not @a 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
+      */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+      insert_iterator&
+      operator=(typename _Container::const_reference __value)
+      {
+	iter = container->insert(iter, __value);
+	++iter;
+	return *this;
+      }
+#else
+      insert_iterator&
+      operator=(const typename _Container::value_type& __value)
+      {
+	iter = container->insert(iter, __value);
+	++iter;
+	return *this;
+      }
+
+      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 @a move.)
+      insert_iterator&
+      operator++()
+      { return *this; }
+
+      /// Simply returns *this.  (This %iterator does not @a 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));
+    }
+
+  // @} group iterators
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // This iterator adapter is @a 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;
+
+      typedef iterator_traits<_Iterator>		__traits_type;
+
+    public:
+      typedef _Iterator					iterator_type;
+      typedef typename __traits_type::iterator_category iterator_category;
+      typedef typename __traits_type::value_type  	value_type;
+      typedef typename __traits_type::difference_type 	difference_type;
+      typedef typename __traits_type::reference 	reference;
+      typedef typename __traits_type::pointer   	pointer;
+
+      _GLIBCXX_CONSTEXPR __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_VERSION
+} // namespace
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
+  // 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;
+
+      typedef iterator_traits<_Iterator>		__traits_type;
+
+    public:
+      typedef _Iterator					iterator_type;
+      typedef typename __traits_type::iterator_category iterator_category;
+      typedef typename __traits_type::value_type  	value_type;
+      typedef typename __traits_type::difference_type	difference_type;
+      // NB: DR 680.
+      typedef _Iterator					pointer;
+      typedef value_type&&				reference;
+
+      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 std::move(*_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 std::move(_M_current[__n]); }
+    };
+
+  // Note: See __normal_iterator operators note from Gaby to understand
+  // why there are always 2 versions for most of the move_iterator
+  // operators.
+  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 _Iterator>
+    inline bool
+    operator==(const move_iterator<_Iterator>& __x,
+	       const move_iterator<_Iterator>& __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 _Iterator>
+    inline bool
+    operator!=(const move_iterator<_Iterator>& __x,
+	       const move_iterator<_Iterator>& __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 _Iterator>
+    inline bool
+    operator<(const move_iterator<_Iterator>& __x,
+	      const move_iterator<_Iterator>& __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 _Iterator>
+    inline bool
+    operator<=(const move_iterator<_Iterator>& __x,
+	       const move_iterator<_Iterator>& __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 _Iterator>
+    inline bool
+    operator>(const move_iterator<_Iterator>& __x,
+	      const move_iterator<_Iterator>& __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); }
+
+  template<typename _Iterator>
+    inline bool
+    operator>=(const move_iterator<_Iterator>& __x,
+	       const move_iterator<_Iterator>& __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 auto
+    operator-(const move_iterator<_Iterator>& __x,
+	      const move_iterator<_Iterator>& __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); }
+
+  // @} group iterators
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_funcs.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_funcs.h
new file mode 100644
index 0000000..836aa92
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_funcs.h
@@ -0,0 +1,203 @@
+// Functions used by iterators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_iterator_base_funcs.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ *
+ *  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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 @a 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 _ForwardIterator>
+    inline _ForwardIterator
+    next(_ForwardIterator __x, typename
+	 iterator_traits<_ForwardIterator>::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 // __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_ITERATOR_BASE_FUNCS_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_types.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_types.h
new file mode 100644
index 0000000..9944dc4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_types.h
@@ -0,0 +1,229 @@
+// Types used in iterator implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_iterator_base_types.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ *
+ *  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>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <type_traits>  // For _GLIBCXX_HAS_NESTED_TYPE
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @defgroup iterators Iterators
+   *  Abstractions for uniform iterating through various underlying types.
+  */
+  //@{ 
+
+  /**
+   *  @defgroup iterator_tags Iterator Tags
+   *  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;
+    };
+
+  /**
+   *  @brief  Traits class for iterators.
+   *
+   *  This class does nothing but define nested typedefs.  The general
+   *  version simply @a forwards the nested typedefs from the Iterator
+   *  argument.  Specialized versions for pointers and pointers-to-const
+   *  provide tighter, more correct semantics.
+  */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_HAS_NESTED_TYPE(iterator_category)
+
+  template<typename _Iterator,
+	   bool = __has_iterator_category<_Iterator>::value>
+    struct __iterator_traits { };
+
+  template<typename _Iterator>
+    struct __iterator_traits<_Iterator, true>
+    {
+      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 _Iterator>
+    struct iterator_traits
+    : public __iterator_traits<_Iterator> { };
+#else
+  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;
+    };
+#endif
+
+  /// Partial specialization for pointer types.
+  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;
+    };
+
+  /// Partial specialization for const pointer types.
+  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(); }
+
+  //@}
+
+  // If _Iterator has a base returns it otherwise _Iterator is returned
+  // untouched
+  template<typename _Iterator, bool _HasBase>
+    struct _Iter_base
+    {
+      typedef _Iterator iterator_type;
+      static iterator_type _S_base(_Iterator __it)
+      { return __it; }
+    };
+
+  template<typename _Iterator>
+    struct _Iter_base<_Iterator, true>
+    {
+      typedef typename _Iterator::iterator_type iterator_type;
+      static iterator_type _S_base(_Iterator __it)
+      { return __it.base(); }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_ITERATOR_BASE_TYPES_H */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_list.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_list.h
new file mode 100644
index 0000000..126de00
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_list.h
@@ -0,0 +1,1630 @@
+// List implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_list.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{list}
+ */
+
+#ifndef _STL_LIST_H
+#define _STL_LIST_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    // 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) throw ();
+      
+      void
+      _M_transfer(_List_node_base* const __first,
+		  _List_node_base* const __last) throw ();
+      
+      void
+      _M_reverse() throw ();
+      
+      void
+      _M_hook(_List_node_base* const __position) throw ();
+      
+      void
+      _M_unhook() throw ();
+    };
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace detail
+
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /// An actual node in the %list.
+  template<typename _Tp>
+    struct _List_node : public __detail::_List_node_base
+    {
+      ///< User's data.
+      _Tp _M_data;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        _List_node(_Args&&... __args)
+	: __detail::_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(__detail::_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 std::__addressof(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.
+      __detail::_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 __detail::_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 std::__addressof(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 __detail::_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
+      {
+	__detail::_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();
+	__detail::_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
+	      (std::__addressof(__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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Creates a %list with default constructed elements.
+       *  @param  n  The number of elements to initially create.
+       *
+       *  This constructor fills the %list with @a n default
+       *  constructed elements.
+       */
+      explicit
+      list(size_type __n)
+      : _Base()
+      { _M_default_initialize(__n); }
+
+      /**
+       *  @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.
+       */
+      list(size_type __n, const value_type& __value,
+	   const allocator_type& __a = allocator_type())
+      : _Base(__a)
+      { _M_fill_initialize(__n, __value); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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::move(__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 1204.
+	// 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(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief Resizes the %list to the specified number of elements.
+       *  @param new_size Number of elements the %list should contain.
+       *
+       *  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 default
+       *  constructed elements are appended.
+       */
+      void
+      resize(size_type __new_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, const value_type& __x);
+#else
+      /**
+       *  @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());
+#endif
+
+      // 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
+      swap(list& __x)
+      {
+	__detail::_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());
+	  }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x)
+      { splice(__position, std::move(__x)); }
+#endif
+
+      /**
+       *  @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);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __i)
+      { splice(__position, std::move(__x), __i); }
+#endif
+
+      /**
+       *  @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);
+	  }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __first, iterator __last)
+      { splice(__position, std::move(__x), __first, __last); }
+#endif
+
+      /**
+       *  @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.
+       */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      merge(list&& __x);
+
+      void
+      merge(list& __x)
+      { merge(std::move(__x)); }
+#else
+      void
+      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().
+       */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _StrictWeakOrdering>
+        void
+        merge(list&&, _StrictWeakOrdering);
+
+      template<typename _StrictWeakOrdering>
+        void
+        merge(list& __x, _StrictWeakOrdering __comp)
+        { merge(std::move(__x), __comp); }
+#else
+      template<typename _StrictWeakOrdering>
+        void
+        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._M_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; --__n)
+	  push_back(__x);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // Called by list(n).
+      void
+      _M_default_initialize(size_type __n)
+      {
+	for (; __n; --__n)
+	  emplace_back();
+      }
+
+      // Called by resize(sz).
+      void
+      _M_default_append(size_type __n);
+#endif
+
+      // 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->_M_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->_M_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->_M_hook(__position._M_node);
+       }
+#endif
+
+      // Erases element at position given.
+      void
+      _M_erase(iterator __position)
+      {
+        __position._M_node->_M_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(std::__addressof(__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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _STL_LIST_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_map.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_map.h
new file mode 100644
index 0000000..a1bef8b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_map.h
@@ -0,0 +1,941 @@
+// Map implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_map.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{map}
+ */
+
+#ifndef _STL_MAP_H
+#define _STL_MAP_H 1
+
+#include <bits/functexcept.h>
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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::move(__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 1204.
+	// 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;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      mapped_type&
+      operator[](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, std::make_pair(std::move(__k), mapped_type()));
+	return (*__i).second;
+      }
+#endif
+
+      // _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__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        std::pair<iterator, bool>
+        insert(_Pair&& __x)
+        { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
+#endif
+
+#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 @a hinting.
+       *
+       *  Insertion requires logarithmic time (if the hint is not taken).
+       */
+      iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      insert(const_iterator __position, const value_type& __x)
+#else
+      insert(iterator __position, const value_type& __x)
+#endif
+      { return _M_t._M_insert_unique_(__position, __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __position, _Pair&& __x)
+        { return _M_t._M_insert_unique_(__position,
+					std::forward<_Pair>(__x)); }
+#endif
+
+      /**
+       *  @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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @brief Erases an element from a %map.
+       *  @param  position  An iterator pointing to the element to be erased.
+       *  @return An iterator pointing to the element immediately following
+       *          @a position prior to the element being erased. If no such 
+       *          element exists, end() is returned.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __position)
+      { return _M_t.erase(__position); }
+
+      // LWG 2059.
+      iterator
+      erase(iterator __position)
+      { return _M_t.erase(__position); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @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.
+       *  @return The iterator @a last.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return _M_t.erase(__first, __last); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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
+      swap(map& __x)
+      { _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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _STL_MAP_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multimap.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multimap.h
new file mode 100644
index 0000000..02e8f58
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multimap.h
@@ -0,0 +1,859 @@
+// Multimap implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_multimap.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{map}
+ */
+
+#ifndef _STL_MULTIMAP_H
+#define _STL_MULTIMAP_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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::move(__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 1204.
+	// 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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(_Pair&& __x)
+        { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
+#endif
+
+      /**
+       *  @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 @a hinting, see:
+       *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+       *
+       *  Insertion requires logarithmic time (if the hint is not taken).
+       */
+      iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      insert(const_iterator __position, const value_type& __x)
+#else
+      insert(iterator __position, const value_type& __x)
+#endif
+      { return _M_t._M_insert_equal_(__position, __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __position, _Pair&& __x)
+        { return _M_t._M_insert_equal_(__position,
+				       std::forward<_Pair>(__x)); }
+#endif
+
+      /**
+       *  @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
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @brief Erases an element from a %multimap.
+       *  @param  position  An iterator pointing to the element to be erased.
+       *  @return An iterator pointing to the element immediately following
+       *          @a position prior to the element being erased. If no such 
+       *          element exists, end() is returned.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __position)
+      { return _M_t.erase(__position); }
+
+      // LWG 2059.
+      iterator
+      erase(iterator __position)
+      { return _M_t.erase(__position); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @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.
+       *  @return The iterator @a last.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return _M_t.erase(__first, __last); }
+#else
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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
+      swap(multimap& __x)
+      { _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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _STL_MULTIMAP_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multiset.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multiset.h
new file mode 100644
index 0000000..9a48916
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multiset.h
@@ -0,0 +1,738 @@
+// Multiset implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_multiset.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{set}
+ */
+
+#ifndef _STL_MULTISET_H
+#define _STL_MULTISET_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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::move(__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 1204.
+	// 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
+      swap(multiset& __x)
+      { _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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(value_type&& __x)
+      { return _M_t._M_insert_equal(std::move(__x)); }
+#endif
+
+      /**
+       *  @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 @a hinting.
+       *
+       *  Insertion requires logarithmic time (if the hint is not taken).
+       */
+      iterator
+      insert(const_iterator __position, const value_type& __x)
+      { return _M_t._M_insert_equal_(__position, __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(const_iterator __position, value_type&& __x)
+      { return _M_t._M_insert_equal_(__position, std::move(__x)); }
+#endif
+
+      /**
+       *  @brief A template function that tries 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
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @brief Erases an element from a %multiset.
+       *  @param  position  An iterator pointing to the element to be erased.
+       *  @return An iterator pointing to the element immediately following
+       *          @a position prior to the element being erased. If no such 
+       *          element exists, end() is returned.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __position)
+      { return _M_t.erase(__position); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @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.
+       *  @return The iterator @a last.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return _M_t.erase(__first, __last); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _STL_MULTISET_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_numeric.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_numeric.h
new file mode 100644
index 0000000..6cbc6d2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_numeric.h
@@ -0,0 +1,387 @@
+// Numeric functions implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_numeric.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{numeric}
+ */
+
+#ifndef _STL_NUMERIC_H
+#define _STL_NUMERIC_H 1
+
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+#include <bits/move.h> // For _GLIBCXX_MOVE
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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_VERSION
+} // namespace std
+
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_ALGO
+
+  /**
+   *  @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 the @c + operator.
+   *  As each successive input value is added into the total, that partial sum
+   *  is written to @p result.  Therefore, the first value in @p result is the
+   *  first value of the input, the second value in @p 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 @p binary_op.
+   *  As each successive input value is added into the total, that partial sum
+   *  is written to @a result.  Therefore, the first value in @p result is the
+   *  first value of the input, the second value in @p 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.
+   *  @param  binary_op  Function object.
+   *  @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.
+   *
+   *  _GLIBCXX_RESOLVE_LIB_DEFECTS
+   *  DR 539. partial_sum and adjacent_difference should mention requirements
+   */
+  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 = _GLIBCXX_MOVE(__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.
+   *
+   *  _GLIBCXX_RESOLVE_LIB_DEFECTS
+   *  DR 539. partial_sum and adjacent_difference should mention requirements
+   */
+  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 = _GLIBCXX_MOVE(__tmp);
+	}
+      return ++__result;
+    }
+
+_GLIBCXX_END_NAMESPACE_ALGO
+} // namespace std
+
+#endif /* _STL_NUMERIC_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_pair.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_pair.h
new file mode 100644
index 0000000..8d137b2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_pair.h
@@ -0,0 +1,279 @@
+// Pair implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_pair.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{utility}
+ */
+
+#ifndef _STL_PAIR_H
+#define _STL_PAIR_H 1
+
+#include <bits/move.h> // for std::move / std::forward, and std::swap
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <type_traits> // for std::__decay_and_strip too
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  /// piecewise_construct_t
+  struct piecewise_construct_t { };
+
+  /// piecewise_construct
+  constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
+
+  // Forward declarations.
+  template<typename...>
+    class tuple;
+
+  template<int...>
+    struct _Index_tuple;
+#endif
+
+  /// Struct holding 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.  */
+      _GLIBCXX_CONSTEXPR pair()
+      : first(), second() { }
+
+      /** Two objects may be passed to a @c pair constructor to be copied.  */
+      _GLIBCXX_CONSTEXPR pair(const _T1& __a, const _T2& __b)
+      : first(__a), second(__b) { }
+
+      /** There is also a templated copy ctor for the @c pair class itself.  */
+      template<class _U1, class _U2>
+	_GLIBCXX_CONSTEXPR pair(const pair<_U1, _U2>& __p)
+	: first(__p.first), second(__p.second) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr pair(const pair&) = default;
+
+      // Implicit.
+      // pair(pair&&) = default;
+
+      // DR 811.
+      template<class _U1, class = typename
+	       std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
+	pair(_U1&& __x, const _T2& __y)
+	: first(std::forward<_U1>(__x)), second(__y) { }
+
+      template<class _U2, class = typename
+	       std::enable_if<std::is_convertible<_U2, _T2>::value>::type>
+	pair(const _T1& __x, _U2&& __y)
+	: first(__x), second(std::forward<_U2>(__y)) { }
+
+      template<class _U1, class _U2, class = typename
+	       std::enable_if<std::is_convertible<_U1, _T1>::value
+			      && std::is_convertible<_U2, _T2>::value>::type>
+	pair(_U1&& __x, _U2&& __y)
+	: first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
+
+      template<class _U1, class _U2>
+	pair(pair<_U1, _U2>&& __p)
+	: first(std::forward<_U1>(__p.first)),
+	  second(std::forward<_U2>(__p.second)) { }
+
+      template<class... _Args1, class... _Args2>
+	pair(piecewise_construct_t,
+	     tuple<_Args1...> __first, tuple<_Args2...> __second)
+	: first(__cons<first_type>(std::move(__first))),
+	  second(__cons<second_type>(std::move(__second))) { }
+
+      pair&
+      operator=(const pair& __p)
+      {
+	first = __p.first;
+	second = __p.second;
+	return *this;
+      }
+
+      pair&
+      operator=(pair&& __p)
+      {
+	first = std::move(__p.first);
+	second = std::move(__p.second);
+	return *this;
+      }
+
+      template<class _U1, class _U2>
+	pair&
+	operator=(const pair<_U1, _U2>& __p)
+	{
+	  first = __p.first;
+	  second = __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);
+      }
+
+    private:
+      template<typename _Tp, typename... _Args>
+	static _Tp
+	__cons(tuple<_Args...>&&);
+
+      template<typename _Tp, typename... _Args, int... _Indexes>
+	static _Tp
+	__do_cons(tuple<_Args...>&&, const _Index_tuple<_Indexes...>&);
+#endif
+    };
+
+  /// Two pairs of the same type are equal iff their members are equal.
+  template<class _T1, class _T2>
+    inline _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR 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); }
+#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
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // 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)
+    {
+      typedef typename __decay_and_strip<_T1>::__type __ds_type1;
+      typedef typename __decay_and_strip<_T2>::__type __ds_type2;
+      typedef pair<__ds_type1, __ds_type2> 	      __pair_type;
+      return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
+    }
+#else
+  template<class _T1, class _T2>
+    inline pair<_T1, _T2>
+    make_pair(_T1 __x, _T2 __y)
+    { return pair<_T1, _T2>(__x, __y); }
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_PAIR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_queue.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_queue.h
new file mode 100644
index 0000000..5f20072
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_queue.h
@@ -0,0 +1,559 @@
+// Queue implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_queue.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{queue}
+ */
+
+#ifndef _STL_QUEUE_H
+#define _STL_QUEUE_H 1
+
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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 @a 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)) { }
+#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)
+      {
+	using std::swap;
+	swap(c, __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, typename _Alloc>
+    struct uses_allocator<queue<_Tp, _Seq>, _Alloc>
+    : public uses_allocator<_Seq, _Alloc>::type { };
+#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 @a 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);
+	}
+#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;
+	swap(c, __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,
+	   typename _Alloc>
+    struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc>
+    : public uses_allocator<_Sequence, _Alloc>::type { };
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_QUEUE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_raw_storage_iter.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_raw_storage_iter.h
new file mode 100644
index 0000000..87c9a66
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_raw_storage_iter.h
@@ -0,0 +1,109 @@
+// -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_raw_storage_iter.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _STL_RAW_STORAGE_ITERATOR_H
+#define _STL_RAW_STORAGE_ITERATOR_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  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(std::__addressof(*_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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_relops.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_relops.h
new file mode 100644
index 0000000..4e79e54
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_relops.h
@@ -0,0 +1,135 @@
+// std::rel_ops implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2008, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 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 bits/stl_relops.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{utility}
+ *
+ *  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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  namespace rel_ops
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /** @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); }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace rel_ops
+
+} // namespace std
+
+#endif /* _STL_RELOPS_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_set.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_set.h
new file mode 100644
index 0000000..77d0f80
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_set.h
@@ -0,0 +1,753 @@
+// Set implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_set.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{set}
+ */
+
+#ifndef _STL_SET_H
+#define _STL_SET_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  @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::move(__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 1204.
+	// 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
+      swap(set& __x)
+      { _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);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      std::pair<iterator, bool>
+      insert(value_type&& __x)
+      {
+	std::pair<typename _Rep_type::iterator, bool> __p =
+	  _M_t._M_insert_unique(std::move(__x));
+	return std::pair<iterator, bool>(__p.first, __p.second);
+      }
+#endif
+
+      /**
+       *  @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 @a hinting, see:
+       *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+       *
+       *  Insertion requires logarithmic time (if the hint is not taken).
+       */
+      iterator
+      insert(const_iterator __position, const value_type& __x)
+      { return _M_t._M_insert_unique_(__position, __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(const_iterator __position, value_type&& __x)
+      { return _M_t._M_insert_unique_(__position, std::move(__x)); }
+#endif
+
+      /**
+       *  @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
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @brief Erases an element from a %set.
+       *  @param  position  An iterator pointing to the element to be erased.
+       *  @return An iterator pointing to the element immediately following
+       *          @a position prior to the element being erased. If no such
+       *          element exists, end() is returned.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __position)
+      { return _M_t.erase(__position); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      /**
+       *  @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.
+       *  @return The iterator @a last.
+       *
+       *  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.
+       */
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return _M_t.erase(__first, __last); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} //namespace std
+#endif /* _STL_SET_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_stack.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_stack.h
new file mode 100644
index 0000000..73c8bbd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_stack.h
@@ -0,0 +1,300 @@
+// Stack implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_stack.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{stack}
+ */
+
+#ifndef _STL_STACK_H
+#define _STL_STACK_H 1
+
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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 @a 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)
+      {
+	using std::swap;
+	swap(c, __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, typename _Alloc>
+    struct uses_allocator<stack<_Tp, _Seq>, _Alloc>
+    : public uses_allocator<_Seq, _Alloc>::type { };
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_STACK_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tempbuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tempbuf.h
new file mode 100644
index 0000000..a99dac9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tempbuf.h
@@ -0,0 +1,273 @@
+// Temporary buffer implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_tempbuf.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _STL_TEMPBUF_H
+#define _STL_TEMPBUF_H 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_construct.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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 <em>the buffer s address and
+   *  capacity (in the units of sizeof(Tp)), or a pair of 0 values if
+   *  no storage can be obtained.</em>  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<bool>
+    struct __uninitialized_construct_buf_dispatch
+    {
+      template<typename _ForwardIterator, typename _Tp>
+        static void
+        __ucr(_ForwardIterator __first, _ForwardIterator __last,
+	      _Tp& __value)
+        {
+	  if(__first == __last)
+	    return;
+
+	  _ForwardIterator __cur = __first;
+	  __try
+	    {
+	      std::_Construct(std::__addressof(*__first),
+			      _GLIBCXX_MOVE(__value));
+	      _ForwardIterator __prev = __cur;
+	      ++__cur;
+	      for(; __cur != __last; ++__cur, ++__prev)
+		std::_Construct(std::__addressof(*__cur),
+				_GLIBCXX_MOVE(*__prev));
+	      __value = _GLIBCXX_MOVE(*__prev);
+	    }
+	  __catch(...)
+	    {
+	      std::_Destroy(__first, __cur);
+	      __throw_exception_again;
+	    }
+	}
+    };
+
+  template<>
+    struct __uninitialized_construct_buf_dispatch<true>
+    {
+      template<typename _ForwardIterator, typename _Tp>
+        static void
+        __ucr(_ForwardIterator, _ForwardIterator, _Tp&) { }
+    };
+
+  // Constructs objects in the range [first, last).
+  // Note that while these new objects will take valid values,
+  // their exact value is not defined. In particular they may
+  // be 'moved from'.
+  //
+  // While __value may altered during this algorithm, it will have
+  // the same value when the algorithm finishes, unless one of the
+  // constructions throws.
+  //
+  // Requirements: _ForwardIterator::value_type(_Tp&&) is valid.
+  template<typename _ForwardIterator, typename _Tp>
+    inline void
+    __uninitialized_construct_buf(_ForwardIterator __first,
+				  _ForwardIterator __last,
+				  _Tp& __value)
+    {
+      typedef typename std::iterator_traits<_ForwardIterator>::value_type
+	_ValueType;
+
+      std::__uninitialized_construct_buf_dispatch<
+        __has_trivial_constructor(_ValueType)>::
+	  __ucr(__first, __last, __value);
+    }
+
+  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(_M_buffer)
+	    std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len,
+					       *__first);
+	}
+      __catch(...)
+	{
+	  std::return_temporary_buffer(_M_buffer);
+	  _M_buffer = 0;
+	  _M_len = 0;
+	  __throw_exception_again;
+	}
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _STL_TEMPBUF_H */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h
new file mode 100644
index 0000000..a7e9564
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h
@@ -0,0 +1,1651 @@
+// RB tree implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_tree.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{map or set}
+ */
+
+#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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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
+    };
+
+  _GLIBCXX_PURE _Rb_tree_node_base*
+  _Rb_tree_increment(_Rb_tree_node_base* __x) throw ();
+
+  _GLIBCXX_PURE const _Rb_tree_node_base*
+  _Rb_tree_increment(const _Rb_tree_node_base* __x) throw ();
+
+  _GLIBCXX_PURE _Rb_tree_node_base*
+  _Rb_tree_decrement(_Rb_tree_node_base* __x) throw ();
+
+  _GLIBCXX_PURE const _Rb_tree_node_base*
+  _Rb_tree_decrement(const _Rb_tree_node_base* __x) throw ();
+
+  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 std::__addressof(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) { }
+
+      iterator
+      _M_const_cast() const
+      { return iterator(static_cast<typename iterator::_Link_type>
+			(const_cast<typename iterator::_Base_ptr>(_M_node))); }
+
+      reference
+      operator*() const
+      { return static_cast<_Link_type>(_M_node)->_M_value_field; }
+
+      pointer
+      operator->() const
+      { return std::__addressof(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) throw ();
+
+  _Rb_tree_node_base*
+  _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
+			       _Rb_tree_node_base& __header) throw ();
+
+
+  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
+	      (std::__addressof(__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(std::__addressof(__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.
+      // Google ref b/1731200.
+#if __google_stl_debug_rbtree
+      template<typename _KeyCompare>
+      struct _CheckedCompare {
+        _KeyCompare _M_key_compare;
+
+        _CheckedCompare(): _M_key_compare() { }
+        _CheckedCompare(const _KeyCompare & __comp): _M_key_compare(__comp) { }
+
+	// Template arg required to avoid duplicating code in the two op()
+	// operators below.  User-provided _M_key_compare may not be const,
+	// but needs to be callable from our const op().
+	// Google ref. b/1731200.
+	template <typename _KeyCompareT>
+        static bool _M_compare_with(_KeyCompareT& __comp, const _Key& __x, const _Key& __y) {
+          if (__comp(__x, __x))
+            __throw_runtime_error("strict weak ordering: (__x LT __x) != false");
+          if (__comp(__y, __y))
+            __throw_runtime_error("strict weak ordering: (__y LT __y) != false");
+          bool lt = __comp(__x, __y);
+          if (lt && __comp(__y, __x))
+            __throw_runtime_error("strict weak ordering: ((__x LT __y) && (__y LT __x)) != false");
+          return lt;
+        }
+        bool operator()(const _Key& __x, const _Key& __y) const {
+	  return _M_compare_with(_M_key_compare, __x, __y);
+        }
+
+        bool operator()(const _Key& __x, const _Key& __y) {
+	  return _M_compare_with(_M_key_compare, __x, __y);
+        }
+
+        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:
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Arg>
+        iterator
+        _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __y, _Arg&& __v);
+
+      template<typename _Arg>
+        iterator
+        _M_insert_lower(_Base_ptr __x, _Base_ptr __y, _Arg&& __v);
+
+      template<typename _Arg>
+        iterator
+        _M_insert_equal_lower(_Arg&& __x);
+#else
+      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);
+#endif
+
+      _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
+      swap(_Rb_tree& __t);      
+
+      // Insert/erase.
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Arg>
+        pair<iterator, bool>
+        _M_insert_unique(_Arg&& __x);
+
+      template<typename _Arg>
+        iterator
+        _M_insert_equal(_Arg&& __x);
+
+      template<typename _Arg>
+        iterator
+        _M_insert_unique_(const_iterator __position, _Arg&& __x);
+
+      template<typename _Arg>
+        iterator
+        _M_insert_equal_(const_iterator __position, _Arg&& __x);
+#else
+      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);
+#endif
+
+      template<typename _InputIterator>
+        void
+        _M_insert_unique(_InputIterator __first, _InputIterator __last);
+
+      template<typename _InputIterator>
+        void
+        _M_insert_equal(_InputIterator __first, _InputIterator __last);
+
+    private:
+      void
+      _M_erase_aux(const_iterator __position);
+
+      void
+      _M_erase_aux(const_iterator __first, const_iterator __last);
+
+    public:
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      iterator
+      erase(const_iterator __position)
+      {
+	const_iterator __result = __position;
+	++__result;
+	_M_erase_aux(__position);
+	return __result._M_const_cast();
+      }
+
+      // LWG 2059.
+      iterator
+      erase(iterator __position)
+      {
+	iterator __result = __position;
+	++__result;
+	_M_erase_aux(__position);
+	return __result;
+      }
+#else
+      void
+      erase(iterator __position)
+      { _M_erase_aux(__position); }
+
+      void
+      erase(const_iterator __position)
+      { _M_erase_aux(__position); }
+#endif
+      size_type
+      erase(const key_type& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 130. Associative erase should return an iterator.
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	_M_erase_aux(__first, __last);
+	return __last._M_const_cast();
+      }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      { _M_erase_aux(__first, __last); }
+
+      void
+      erase(const_iterator __first, const_iterator __last)
+      { _M_erase_aux(__first, __last); }
+#endif
+      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>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __p, _Arg&& __v)
+#else
+    _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)
+#endif
+    {
+      bool __insert_left = (__x != 0 || __p == _M_end()
+			    || _M_impl._M_key_compare(_KeyOfValue()(__v), 
+						      _S_key(__p)));
+
+      _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __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>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_lower(_Base_ptr __x, _Base_ptr __p, _Arg&& __v)
+#else
+    _M_insert_lower(_Base_ptr __x, _Base_ptr __p, const _Val& __v)
+#endif
+    {
+      bool __insert_left = (__x != 0 || __p == _M_end()
+			    || !_M_impl._M_key_compare(_S_key(__p),
+						       _KeyOfValue()(__v)));
+
+      _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __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>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_equal_lower(_Arg&& __v)
+#else
+    _M_insert_equal_lower(const _Val& __v)
+#endif
+    {
+      _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, _GLIBCXX_FORWARD(_Arg, __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>::
+    swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
+    {
+      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>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
+			   _Compare, _Alloc>::iterator, bool>
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_unique(_Arg&& __v)
+#else
+    _M_insert_unique(const _Val& __v)
+#endif
+    {
+      _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, _GLIBCXX_FORWARD(_Arg, __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, _GLIBCXX_FORWARD(_Arg, __v)), true);
+      return pair<iterator, bool>(__j, false);
+    }
+
+  template<typename _Key, typename _Val, typename _KeyOfValue,
+           typename _Compare, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_equal(_Arg&& __v)
+#else
+    _M_insert_equal(const _Val& __v)
+#endif
+    {
+      _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, _GLIBCXX_FORWARD(_Arg, __v));
+    }
+
+  template<typename _Key, typename _Val, typename _KeyOfValue,
+           typename _Compare, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_unique_(const_iterator __position, _Arg&& __v)
+#else
+    _M_insert_unique_(const_iterator __position, const _Val& __v)
+#endif
+    {
+      // 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(), _GLIBCXX_FORWARD(_Arg, __v));
+	  else
+	    return _M_insert_unique(_GLIBCXX_FORWARD(_Arg, __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(),
+			      _GLIBCXX_FORWARD(_Arg, __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,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	      else
+		return _M_insert_(__position._M_node,
+				  __position._M_node,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	    }
+	  else
+	    return _M_insert_unique(_GLIBCXX_FORWARD(_Arg, __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(),
+			      _GLIBCXX_FORWARD(_Arg, __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,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	      else
+		return _M_insert_(__after._M_node, __after._M_node,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	    }
+	  else
+	    return _M_insert_unique(_GLIBCXX_FORWARD(_Arg, __v)).first;
+	}
+      else
+	// Equivalent keys.
+	return __position._M_const_cast();
+    }
+
+  template<typename _Key, typename _Val, typename _KeyOfValue,
+           typename _Compare, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename _Arg>
+#endif
+    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    _M_insert_equal_(const_iterator __position, _Arg&& __v)
+#else
+    _M_insert_equal_(const_iterator __position, const _Val& __v)
+#endif
+    {
+      // 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(),
+			      _GLIBCXX_FORWARD(_Arg, __v));
+	  else
+	    return _M_insert_equal(_GLIBCXX_FORWARD(_Arg, __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(),
+			      _GLIBCXX_FORWARD(_Arg, __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,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	      else
+		return _M_insert_(__position._M_node,
+				  __position._M_node,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	    }
+	  else
+	    return _M_insert_equal(_GLIBCXX_FORWARD(_Arg, __v));
+	}
+      else
+	{
+	  // ... then try after.  
+	  const_iterator __after = __position;
+	  if (__position._M_node == _M_rightmost())
+	    return _M_insert_(0, _M_rightmost(),
+			      _GLIBCXX_FORWARD(_Arg, __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,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	      else
+		return _M_insert_(__after._M_node, __after._M_node,
+				  _GLIBCXX_FORWARD(_Arg, __v));
+	    }
+	  else
+	    return _M_insert_equal_lower(_GLIBCXX_FORWARD(_Arg, __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>
+    void
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+    _M_erase_aux(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>
+    void
+    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+    _M_erase_aux(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>
+    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(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;
+    }
+
+  _GLIBCXX_PURE unsigned int
+  _Rb_tree_black_count(const _Rb_tree_node_base* __node,
+                       const _Rb_tree_node_base* __root) throw ();
+
+  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_uninitialized.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_uninitialized.h
new file mode 100644
index 0000000..70ce545
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_uninitialized.h
@@ -0,0 +1,655 @@
+// Raw memory manipulators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_uninitialized.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _STL_UNINITIALIZED_H
+#define _STL_UNINITIALIZED_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<bool _TrivialValueTypes>
+    struct __uninitialized_copy
+    {
+      template<typename _InputIterator, typename _ForwardIterator>
+        static _ForwardIterator
+        __uninit_copy(_InputIterator __first, _InputIterator __last,
+		      _ForwardIterator __result)
+        {
+	  _ForwardIterator __cur = __result;
+	  __try
+	    {
+	      for (; __first != __last; ++__first, ++__cur)
+		std::_Construct(std::__addressof(*__cur), *__first);
+	      return __cur;
+	    }
+	  __catch(...)
+	    {
+	      std::_Destroy(__result, __cur);
+	      __throw_exception_again;
+	    }
+	}
+    };
+
+  template<>
+    struct __uninitialized_copy<true>
+    {
+      template<typename _InputIterator, typename _ForwardIterator>
+        static _ForwardIterator
+        __uninit_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_trivial(_ValueType1)
+					&& __is_trivial(_ValueType2))>::
+	__uninit_copy(__first, __last, __result);
+    }
+
+
+  template<bool _TrivialValueType>
+    struct __uninitialized_fill
+    {
+      template<typename _ForwardIterator, typename _Tp>
+        static void
+        __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
+		      const _Tp& __x)
+        {
+	  _ForwardIterator __cur = __first;
+	  __try
+	    {
+	      for (; __cur != __last; ++__cur)
+		std::_Construct(std::__addressof(*__cur), __x);
+	    }
+	  __catch(...)
+	    {
+	      std::_Destroy(__first, __cur);
+	      __throw_exception_again;
+	    }
+	}
+    };
+
+  template<>
+    struct __uninitialized_fill<true>
+    {
+      template<typename _ForwardIterator, typename _Tp>
+        static void
+        __uninit_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_trivial(_ValueType)>::
+	__uninit_fill(__first, __last, __x);
+    }
+
+
+  template<bool _TrivialValueType>
+    struct __uninitialized_fill_n
+    {
+      template<typename _ForwardIterator, typename _Size, typename _Tp>
+        static void
+        __uninit_fill_n(_ForwardIterator __first, _Size __n,
+			const _Tp& __x)
+        {
+	  _ForwardIterator __cur = __first;
+	  __try
+	    {
+	      for (; __n > 0; --__n, ++__cur)
+		std::_Construct(std::__addressof(*__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
+        __uninit_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_trivial(_ValueType)>::
+	__uninit_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(std::__addressof(*__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(std::__addressof(*__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(std::__addressof(*__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__
+  // Extensions: __uninitialized_default, __uninitialized_default_n,
+  // __uninitialized_default_a, __uninitialized_default_n_a.
+
+  template<bool _TrivialValueType>
+    struct __uninitialized_default_1
+    {
+      template<typename _ForwardIterator>
+        static void
+        __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
+        {
+	  _ForwardIterator __cur = __first;
+	  __try
+	    {
+	      for (; __cur != __last; ++__cur)
+		std::_Construct(std::__addressof(*__cur));
+	    }
+	  __catch(...)
+	    {
+	      std::_Destroy(__first, __cur);
+	      __throw_exception_again;
+	    }
+	}
+    };
+
+  template<>
+    struct __uninitialized_default_1<true>
+    {
+      template<typename _ForwardIterator>
+        static void
+        __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
+        {
+	  typedef typename iterator_traits<_ForwardIterator>::value_type
+	    _ValueType;
+
+	  std::fill(__first, __last, _ValueType());
+	}
+    };
+
+  template<bool _TrivialValueType>
+    struct __uninitialized_default_n_1
+    {
+      template<typename _ForwardIterator, typename _Size>
+        static void
+        __uninit_default_n(_ForwardIterator __first, _Size __n)
+        {
+	  _ForwardIterator __cur = __first;
+	  __try
+	    {
+	      for (; __n > 0; --__n, ++__cur)
+		std::_Construct(std::__addressof(*__cur));
+	    }
+	  __catch(...)
+	    {
+	      std::_Destroy(__first, __cur);
+	      __throw_exception_again;
+	    }
+	}
+    };
+
+  template<>
+    struct __uninitialized_default_n_1<true>
+    {
+      template<typename _ForwardIterator, typename _Size>
+        static void
+        __uninit_default_n(_ForwardIterator __first, _Size __n)
+        {
+	  typedef typename iterator_traits<_ForwardIterator>::value_type
+	    _ValueType;
+
+	  std::fill_n(__first, __n, _ValueType());
+	}
+    };
+
+  // __uninitialized_default
+  // Fills [first, last) with std::distance(first, last) default
+  // constructed value_types(s).
+  template<typename _ForwardIterator>
+    inline void
+    __uninitialized_default(_ForwardIterator __first,
+			    _ForwardIterator __last)
+    {
+      typedef typename iterator_traits<_ForwardIterator>::value_type
+	_ValueType;
+
+      std::__uninitialized_default_1<__is_trivial(_ValueType)>::
+	__uninit_default(__first, __last);
+    }
+
+  // __uninitialized_default_n
+  // Fills [first, first + n) with n default constructed value_type(s).
+  template<typename _ForwardIterator, typename _Size>
+    inline void
+    __uninitialized_default_n(_ForwardIterator __first, _Size __n)
+    {
+      typedef typename iterator_traits<_ForwardIterator>::value_type
+	_ValueType;
+
+      std::__uninitialized_default_n_1<__is_trivial(_ValueType)>::
+	__uninit_default_n(__first, __n);
+    }
+
+ template<typename _Tp, typename _Allocator>
+   inline auto
+   _Construct_default_a_impl(_Tp* __ptr, _Allocator& __alloc, void*)
+   -> decltype(__alloc.construct(__ptr))
+   { return __alloc.construct(__ptr); }
+
+  template<typename _Tp, typename _Allocator>
+   inline void
+   _Construct_default_a_impl(_Tp* __ptr, _Allocator& __alloc, ...)
+   { _Construct(__ptr); }
+
+  template<typename _Tp, typename _Allocator>
+   inline void
+   _Construct_default_a(_Tp* __ptr, _Allocator& __alloc)
+   { _Construct_default_a_impl(__ptr, __alloc, nullptr); }
+
+  // __uninitialized_default_a
+  // Fills [first, last) with std::distance(first, last) default
+  // constructed value_types(s), constructed with the allocator alloc.
+  template<typename _ForwardIterator, typename _Allocator>
+    void
+    __uninitialized_default_a(_ForwardIterator __first,
+			      _ForwardIterator __last,
+			      _Allocator& __alloc)
+    {
+      _ForwardIterator __cur = __first;
+      __try
+	{
+	  for (; __cur != __last; ++__cur)
+	    _Construct_default_a(std::__addressof(*__cur), __alloc);
+	}
+      __catch(...)
+	{
+	  std::_Destroy(__first, __cur, __alloc);
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _ForwardIterator, typename _Tp>
+    inline void
+    __uninitialized_default_a(_ForwardIterator __first,
+			      _ForwardIterator __last,
+			      allocator<_Tp>&)
+    { std::__uninitialized_default(__first, __last); }
+
+
+  // __uninitialized_default_n_a
+  // Fills [first, first + n) with n default constructed value_types(s),
+  // constructed with the allocator alloc.
+  template<typename _ForwardIterator, typename _Size, typename _Allocator>
+    void
+    __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
+				_Allocator& __alloc)
+    {
+      _ForwardIterator __cur = __first;
+      __try
+	{
+	  for (; __n > 0; --__n, ++__cur)
+	    _Construct_default_a(std::__addressof(*__cur), __alloc);
+	}
+      __catch(...)
+	{
+	  std::_Destroy(__first, __cur, __alloc);
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _ForwardIterator, typename _Size, typename _Tp>
+    inline void
+    __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
+				allocator<_Tp>&)
+    { std::__uninitialized_default_n(__first, __n); }
+
+
+  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)
+	    std::_Construct(std::__addressof(*__cur), *__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_VERSION
+} // namespace
+
+#endif /* _STL_UNINITIALIZED_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h
new file mode 100644
index 0000000..8b7fdb1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h
@@ -0,0 +1,1398 @@
+// Vector implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/stl_vector.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{vector}
+ */
+
+#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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /// 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)
+      : _M_impl()
+      {
+	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;
+      }
+
+      _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;
+
+      bool _M_is_valid() const
+      {
+        return (this->_M_impl._M_end_of_storage == 0
+		&& this->_M_impl._M_start == 0
+		&& this->_M_impl._M_finish == 0)
+	      || (this->_M_impl._M_start <= this->_M_impl._M_finish
+		  && this->_M_impl._M_finish <= this->_M_impl._M_end_of_storage
+		  && this->_M_impl._M_start < this->_M_impl._M_end_of_storage);
+      }
+
+    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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Creates a %vector with default constructed elements.
+       *  @param  n  The number of elements to initially create.
+       *
+       *  This constructor fills the %vector with @a n default
+       *  constructed elements.
+       */
+      explicit
+      vector(size_type __n)
+      : _Base(__n)
+      { _M_default_initialize(__n); }
+
+      /**
+       *  @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.
+       */
+      vector(size_type __n, const value_type& __value,
+	     const allocator_type& __a = allocator_type())
+      : _Base(__n, __a)
+      { _M_fill_initialize(__n, __value); }
+#else
+      /**
+       *  @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); }
+#endif
+
+      /**
+       *  @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::move(__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 1204.
+	// 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()
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("begin() on corrupt (dangling?) vector");
+#endif
+	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
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("begin() on corrupt (dangling?) vector");
+#endif
+	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()
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("end() on corrupt (dangling?) vector");
+#endif
+	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
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("end() on corrupt (dangling?) vector");
+#endif
+	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
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("size() on corrupt (dangling?) vector");
+#endif
+	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(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Resizes the %vector to the specified number of elements.
+       *  @param  new_size  Number of elements the %vector should contain.
+       *
+       *  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
+       *  default constructed elements are appended.
+       */
+      void
+      resize(size_type __new_size)
+      {
+	if (__new_size > size())
+	  _M_default_append(__new_size - size());
+	else if (__new_size < size())
+	  _M_erase_at_end(this->_M_impl._M_start + __new_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, const value_type& __x)
+      {
+	if (__new_size > size())
+	  insert(end(), __new_size - size(), __x);
+	else if (__new_size < size())
+	  _M_erase_at_end(this->_M_impl._M_start + __new_size);
+      }
+#else
+      /**
+       *  @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())
+	  insert(end(), __new_size - size(), __x);
+	else if (__new_size < size())
+	  _M_erase_at_end(this->_M_impl._M_start + __new_size);
+      }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**  A non-binding request to reduce capacity() to size().  */
+      void
+      shrink_to_fit()
+      { std::__shrink_to_fit<vector>::_S_do_it(*this); }
+#endif
+
+      /**
+       *  Returns the total number of elements that the %vector can
+       *  hold before needing to allocate more memory.
+       */
+      size_type
+      capacity() const
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("capacity() on corrupt (dangling?) vector");
+#endif
+	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().
+       */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      _Tp*
+#else
+      pointer
+#endif
+      data()
+      { return std::__addressof(front()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      const _Tp*
+#else
+      const_pointer
+#endif
+      data() const
+      { return std::__addressof(front()); }
+
+      // [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
+      swap(vector& __x)
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid() || !__x._M_is_valid())
+          __throw_logic_error("swap() on corrupt (dangling?) vector");
+#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()
+      {
+#if __google_stl_debug_dangling_vector
+        if (!this->_M_is_valid())
+          __throw_logic_error("clear() on corrupt (dangling?) vector");
+#endif
+	_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;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // Called by the vector(n) constructor.
+      void
+      _M_default_initialize(size_type __n)
+      {
+	std::__uninitialized_default_n_a(this->_M_impl._M_start, __n, 
+					 _M_get_Tp_allocator());
+	this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
+      }
+#endif
+
+      // 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);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // Called by resize(n).
+      void
+      _M_default_append(size_type __n);
+#endif
+
+      // 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); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _STL_VECTOR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stream_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stream_iterator.h
new file mode 100644
index 0000000..57ca961
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stream_iterator.h
@@ -0,0 +1,221 @@
+// Stream iterators
+
+// Copyright (C) 2001, 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/stream_iterator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ */
+
+#ifndef _STREAM_ITERATOR_H
+#define _STREAM_ITERATOR_H 1
+
+#pragma GCC system_header
+
+#include <debug/debug.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
+  /// 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.
+      _GLIBCXX_CONSTEXPR 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; }
+    };
+
+  // @} group iterators
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf.tcc
new file mode 100644
index 0000000..6cb85fc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf.tcc
@@ -0,0 +1,176 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/streambuf.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{streambuf}
+ */
+
+//
+// ISO C++ 14882: 27.5  Stream buffers
+//
+
+#ifndef _STREAMBUF_TCC
+#define _STREAMBUF_TCC 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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->__safe_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->__safe_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.
+#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_VERSION
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf_iterator.h
new file mode 100644
index 0000000..83ae678
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf_iterator.h
@@ -0,0 +1,402 @@
+// Streambuf iterators
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/streambuf_iterator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iterator}
+ */
+
+#ifndef _STREAMBUF_ITERATOR_H
+#define _STREAMBUF_ITERATOR_H 1
+
+#pragma GCC system_header
+
+#include <streambuf>
+#include <debug/debug.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+     
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
+  // 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.
+      _GLIBCXX_CONSTEXPR 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->__safe_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->__safe_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;
+    }
+
+// @} group iterators
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stringfwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stringfwd.h
new file mode 100644
index 0000000..5f2d49c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stringfwd.h
@@ -0,0 +1,88 @@
+// String support -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/stringfwd.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{string}
+ */
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _STRINGFWD_H
+#define _STRINGFWD_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _Alloc>
+    class allocator;
+
+  /**
+   *  @defgroup strings Strings
+   *
+   *  @{
+  */
+
+  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;   /// A string of @c char
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  template<> struct char_traits<wchar_t>;
+
+  typedef basic_string<wchar_t> wstring;   /// A string of @c wchar_t
+#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; /// A string of @c char16_t
+  typedef basic_string<char32_t> u32string; /// A string of @c char32_t
+
+#endif
+  /** @}  */
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif	// _STRINGFWD_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unique_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unique_ptr.h
new file mode 100644
index 0000000..cb2d860
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unique_ptr.h
@@ -0,0 +1,511 @@
+// unique_ptr implementation -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/unique_ptr.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _UNIQUE_PTR_H
+#define _UNIQUE_PTR_H 1
+
+#include <bits/c++config.h>
+#include <debug/debug.h>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup pointer_abstractions
+   * @{
+   */
+
+  /// Primary template, default_delete.
+  template<typename _Tp>
+    struct default_delete
+    {
+      constexpr default_delete() = default;
+
+      template<typename _Up, typename = typename
+	       std::enable_if<std::is_convertible<_Up*, _Tp*>::value>::type>
+        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[]>
+    {
+      constexpr default_delete() = default;
+
+      void
+      operator()(_Tp* __ptr) const
+      {
+	static_assert(sizeof(_Tp)>0,
+		      "can't delete pointer to incomplete type");
+	delete [] __ptr;
+      }
+
+      template<typename _Up> void operator()(_Up*) const = delete;
+    };
+
+  /// 20.7.12.2 unique_ptr for single objects.
+  template <typename _Tp, typename _Dp = default_delete<_Tp> >
+    class unique_ptr
+    {
+      // use SFINAE to determine whether _Del::pointer exists
+      class _Pointer
+      {
+	template<typename _Up>
+	  static typename _Up::pointer __test(typename _Up::pointer*);
+
+	template<typename _Up>
+	  static _Tp* __test(...);
+
+	typedef typename remove_reference<_Dp>::type _Del;
+
+      public:
+	typedef decltype( __test<_Del>(0)) type;
+      };
+
+      typedef std::tuple<typename _Pointer::type, _Dp>  __tuple_type;
+      __tuple_type                                      _M_t;
+
+    public:
+      typedef typename _Pointer::type   pointer;
+      typedef _Tp                       element_type;
+      typedef _Dp                       deleter_type;
+
+      // Constructors.
+      constexpr unique_ptr()
+      : _M_t()
+      { 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"); }
+
+      constexpr unique_ptr(nullptr_t)
+      : _M_t()
+      { static_assert(!std::is_pointer<deleter_type>::value,
+		     "constructed with null function pointer deleter"); }
+
+      // Move constructors.
+      unique_ptr(unique_ptr&& __u)
+      : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
+
+      template<typename _Up, typename _Ep, typename = typename
+	std::enable_if
+	  <std::is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
+			       pointer>::value
+	   && !std::is_array<_Up>::value
+	   && ((std::is_reference<_Dp>::value
+		&& std::is_same<_Ep, _Dp>::value)
+	       || (!std::is_reference<_Dp>::value
+		   && std::is_convertible<_Ep, _Dp>::value))>
+	     ::type>
+	unique_ptr(unique_ptr<_Up, _Ep>&& __u)
+	: _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
+	{ }
+
+#if _GLIBCXX_USE_DEPRECATED
+      template<typename _Up, typename = typename
+	std::enable_if<std::is_convertible<_Up*, _Tp*>::value
+		       && std::is_same<_Dp,
+				       default_delete<_Tp>>::value>::type>
+	unique_ptr(auto_ptr<_Up>&& __u)
+	: _M_t(__u.release(), deleter_type()) { }
+#endif
+
+      // Destructor.
+      ~unique_ptr() { reset(); }
+
+      // Assignment.
+      unique_ptr&
+      operator=(unique_ptr&& __u)
+      {
+	reset(__u.release());
+	get_deleter() = std::forward<deleter_type>(__u.get_deleter());
+	return *this;
+      }
+
+      template<typename _Up, typename _Ep, typename = typename
+	std::enable_if
+	  <std::is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
+			       pointer>::value
+	   && !std::is_array<_Up>::value>::type>
+	unique_ptr&
+	operator=(unique_ptr<_Up, _Ep>&& __u)
+	{
+	  reset(__u.release());
+	  get_deleter() = std::forward<_Ep>(__u.get_deleter());
+	  return *this;
+	}
+
+      unique_ptr&
+      operator=(nullptr_t)
+      {
+	reset();
+	return *this;
+      }
+
+      // Observers.
+      typename std::add_lvalue_reference<element_type>::type
+      operator*() const
+      {
+	_GLIBCXX_DEBUG_ASSERT(get() != pointer());
+	return *get();
+      }
+
+      pointer
+      operator->() const
+      {
+	_GLIBCXX_DEBUG_ASSERT(get() != pointer());
+	return get();
+      }
+
+      pointer
+      get() const
+      { return std::get<0>(_M_t); }
+
+      deleter_type&
+      get_deleter()
+      { return std::get<1>(_M_t); }
+
+      const deleter_type&
+      get_deleter() const
+      { return std::get<1>(_M_t); }
+
+      explicit operator bool() const
+      { return get() == pointer() ? false : true; }
+
+      // Modifiers.
+      pointer
+      release()
+      {
+	pointer __p = get();
+	std::get<0>(_M_t) = pointer();
+	return __p;
+      }
+
+      void
+      reset(pointer __p = pointer())
+      {
+	using std::swap;
+	swap(std::get<0>(_M_t), __p);
+	if (__p != pointer())
+	  get_deleter()(__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;
+      unique_ptr& operator=(const unique_ptr&) = delete;
+  };
+
+  /// 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 _Dp>
+    class unique_ptr<_Tp[], _Dp>
+    {
+      typedef std::tuple<_Tp*, _Dp>  	__tuple_type;
+      __tuple_type 			_M_t;
+
+    public:
+      typedef _Tp*		 	pointer;
+      typedef _Tp		 	element_type;
+      typedef _Dp                       deleter_type;
+
+      // Constructors.
+      constexpr unique_ptr()
+      : _M_t()
+      { 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"); }
+
+      constexpr unique_ptr(nullptr_t)
+      : _M_t()
+      { static_assert(!std::is_pointer<deleter_type>::value,
+		     "constructed with null function pointer deleter"); }
+
+      // Move constructors.
+      unique_ptr(unique_ptr&& __u)
+      : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
+
+      template<typename _Up, typename _Ep>
+	unique_ptr(unique_ptr<_Up, _Ep>&& __u)
+	: _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter()))
+	{ }
+
+      // Destructor.
+      ~unique_ptr() { reset(); }
+
+      // Assignment.
+      unique_ptr&
+      operator=(unique_ptr&& __u)
+      {
+	reset(__u.release());
+	get_deleter() = std::forward<deleter_type>(__u.get_deleter());
+	return *this;
+      }
+
+      template<typename _Up, typename _Ep>
+	unique_ptr&
+	operator=(unique_ptr<_Up, _Ep>&& __u)
+	{
+	  reset(__u.release());
+	  get_deleter() = std::forward<_Ep>(__u.get_deleter());
+	  return *this;
+	}
+
+      unique_ptr&
+      operator=(nullptr_t)
+      {
+	reset();
+	return *this;
+      }
+
+      // Observers.
+      typename std::add_lvalue_reference<element_type>::type
+      operator[](size_t __i) const
+      {
+	_GLIBCXX_DEBUG_ASSERT(get() != pointer());
+	return get()[__i];
+      }
+
+      pointer
+      get() const
+      { return std::get<0>(_M_t); }
+
+      deleter_type&
+      get_deleter()
+      { return std::get<1>(_M_t); }
+
+      const deleter_type&
+      get_deleter() const
+      { return std::get<1>(_M_t); }
+
+      explicit operator bool() const
+      { return get() == pointer() ? false : true; }
+
+      // Modifiers.
+      pointer
+      release()
+      {
+	pointer __p = get();
+	std::get<0>(_M_t) = pointer();
+	return __p;
+      }
+
+      void
+      reset(pointer __p = pointer())
+      {
+	using std::swap;
+	swap(std::get<0>(_M_t), __p);
+	if (__p != nullptr)
+	  get_deleter()(__p);
+      }
+
+      void
+      reset(nullptr_t)
+      {
+	pointer __p = get();
+	std::get<0>(_M_t) = pointer();
+	if (__p != nullptr)
+	  get_deleter()(__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;
+  };
+
+  template<typename _Tp, typename _Dp>
+    inline void
+    swap(unique_ptr<_Tp, _Dp>& __x,
+	 unique_ptr<_Tp, _Dp>& __y)
+    { __x.swap(__y); }
+
+  template<typename _Tp, typename _Dp,
+	   typename _Up, typename _Ep>
+    inline bool
+    operator==(const unique_ptr<_Tp, _Dp>& __x,
+	       const unique_ptr<_Up, _Ep>& __y)
+    { return __x.get() == __y.get(); }
+
+  template<typename _Tp, typename _Dp>
+    inline bool
+    operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
+    { return __x.get() == nullptr; }
+
+  template<typename _Tp, typename _Dp>
+    inline bool
+    operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __y)
+    { return nullptr == __y.get(); }
+
+  template<typename _Tp, typename _Dp,
+	   typename _Up, typename _Ep>
+    inline bool
+    operator!=(const unique_ptr<_Tp, _Dp>& __x,
+	       const unique_ptr<_Up, _Ep>& __y)
+    { return !(__x.get() == __y.get()); }
+
+  template<typename _Tp, typename _Dp>
+    inline bool
+    operator!=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
+    { return __x.get() != nullptr; }
+
+  template<typename _Tp, typename _Dp>
+    inline bool
+    operator!=(nullptr_t, const unique_ptr<_Tp, _Dp>& __y)
+    { return nullptr != __y.get(); }
+
+  template<typename _Tp, typename _Dp,
+	   typename _Up, typename _Ep>
+    inline bool
+    operator<(const unique_ptr<_Tp, _Dp>& __x,
+	      const unique_ptr<_Up, _Ep>& __y)
+    { return __x.get() < __y.get(); }
+
+  template<typename _Tp, typename _Dp,
+	   typename _Up, typename _Ep>
+    inline bool
+    operator<=(const unique_ptr<_Tp, _Dp>& __x,
+	       const unique_ptr<_Up, _Ep>& __y)
+    { return !(__y.get() < __x.get()); }
+
+  template<typename _Tp, typename _Dp,
+	   typename _Up, typename _Ep>
+    inline bool
+    operator>(const unique_ptr<_Tp, _Dp>& __x,
+	      const unique_ptr<_Up, _Ep>& __y)
+    { return __y.get() < __x.get(); }
+
+  template<typename _Tp, typename _Dp,
+	   typename _Up, typename _Ep>
+    inline bool
+    operator>=(const unique_ptr<_Tp, _Dp>& __x,
+	       const unique_ptr<_Up, _Ep>& __y)
+    { return !(__x.get() < __y.get()); }
+
+  /// std::hash specialization for unique_ptr.
+  template<typename _Tp, typename _Dp>
+    struct hash<unique_ptr<_Tp, _Dp>>
+    : public std::unary_function<unique_ptr<_Tp, _Dp>, size_t>
+    {
+      size_t
+      operator()(const unique_ptr<_Tp, _Dp>& __u) const noexcept
+      {
+	typedef unique_ptr<_Tp, _Dp> _UP;
+	return std::hash<typename _UP::pointer>()(__u.get());
+      }
+    };
+
+  // @} group pointer_abstractions
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _UNIQUE_PTR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_map.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_map.h
new file mode 100644
index 0000000..c77bab1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_map.h
@@ -0,0 +1,409 @@
+// unordered_map implementation -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/unordered_map.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{unordered_map}
+ */
+
+#ifndef _UNORDERED_MAP_H
+#define _UNORDERED_MAP_H
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  // NB: 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::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, __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 = 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)
+	{ }
+
+      __unordered_map(initializer_list<value_type> __l,
+		      size_type __n = 0,
+		      const hasher& __hf = hasher(),
+		      const key_equal& __eql = key_equal(),
+		      const allocator_type& __a = allocator_type())
+      : _Base(__l.begin(), __l.end(), __n, __hf,
+	      __detail::_Mod_range_hashing(),
+	      __detail::_Default_ranged_hash(),
+	      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
+      { }
+
+      __unordered_map&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+  
+  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::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, __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, 
+			     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)
+        { }
+
+      __unordered_multimap(initializer_list<value_type> __l,
+			   size_type __n = 0,
+			   const hasher& __hf = hasher(),
+			   const key_equal& __eql = key_equal(),
+			   const allocator_type& __a = allocator_type())
+      : _Base(__l.begin(), __l.end(), __n, __hf,
+	      __detail::_Mod_range_hashing(),
+	      __detail::_Default_ranged_hash(),
+	      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
+      { }
+
+      __unordered_multimap&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+
+  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); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator==(const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator!=(const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return !(__x == __y); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator==(const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator!=(const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return !(__x == __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 = 0,
+		      const hasher& __hf = hasher(), 
+		      const key_equal& __eql = key_equal(), 
+		      const allocator_type& __a = allocator_type())
+	: _Base(__f, __l, __n, __hf, __eql, __a)
+        { }
+
+      unordered_map(initializer_list<value_type> __l,
+		    size_type __n = 0,
+		    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=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+  
+  /**
+   *  @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, 
+			   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)
+        { }
+
+      unordered_multimap(initializer_list<value_type> __l,
+			 size_type __n = 0,
+			 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=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+
+  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 bool
+    operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+    inline bool
+    operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+    inline bool
+    operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+    inline bool
+    operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _UNORDERED_MAP_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_set.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_set.h
new file mode 100644
index 0000000..38350bc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_set.h
@@ -0,0 +1,401 @@
+// unordered_set implementation -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/unordered_set.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{unordered_set}
+ */
+
+#ifndef _UNORDERED_SET_H
+#define _UNORDERED_SET_H
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  // NB: 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::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, __detail::_Mod_range_hashing(),
+	      __detail::_Default_ranged_hash(), __eql,
+	      std::_Identity<value_type>(), __a)
+      { }
+
+      template<typename _InputIterator>
+        __unordered_set(_InputIterator __f, _InputIterator __l, 
+			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_type>(), __a)
+        { }
+
+      __unordered_set(initializer_list<value_type> __l,
+		      size_type __n = 0,
+		      const hasher& __hf = hasher(),
+		      const key_equal& __eql = key_equal(),
+		      const allocator_type& __a = allocator_type())
+      : _Base(__l.begin(), __l.end(), __n, __hf,
+	      __detail::_Mod_range_hashing(),
+	      __detail::_Default_ranged_hash(), __eql,
+	      std::_Identity<value_type>(), __a)
+      { }
+
+      __unordered_set&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+
+  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::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, __detail::_Mod_range_hashing(),
+	      __detail::_Default_ranged_hash(), __eql,
+	      std::_Identity<value_type>(), __a)
+      { }
+
+
+      template<typename _InputIterator>
+        __unordered_multiset(_InputIterator __f, _InputIterator __l, 
+			     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_type>(), __a)
+        { }
+
+      __unordered_multiset(initializer_list<value_type> __l,
+			   size_type __n = 0,
+			   const hasher& __hf = hasher(),
+			   const key_equal& __eql = key_equal(),
+			   const allocator_type& __a = allocator_type())
+      : _Base(__l.begin(), __l.end(), __n, __hf,
+	      __detail::_Mod_range_hashing(),
+	      __detail::_Default_ranged_hash(), __eql,
+	      std::_Identity<value_type>(), __a)
+      { }
+
+      __unordered_multiset&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+
+  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); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator==(const __unordered_set<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_set<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator!=(const __unordered_set<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_set<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return !(__x == __y); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator==(const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc,
+	   bool __cache_hash_code>
+    inline bool
+    operator!=(const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __x,
+	       const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
+	       __cache_hash_code>& __y)
+    { return !(__x == __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 = 0,
+		      const hasher& __hf = hasher(), 
+		      const key_equal& __eql = key_equal(), 
+		      const allocator_type& __a = allocator_type())
+	: _Base(__f, __l, __n, __hf, __eql, __a)
+        { }
+
+      unordered_set(initializer_list<value_type> __l,
+		    size_type __n = 0,
+		    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=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+
+  /**
+   *  @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, 
+			   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)
+        { }
+
+      unordered_multiset(initializer_list<value_type> __l,
+			 size_type __n = 0,
+			 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=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l.begin(), __l.end());
+	return *this;
+      }
+    };
+
+  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 bool
+    operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc>
+    inline bool
+    operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc>
+    inline bool
+    operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<class _Value, class _Hash, class _Pred, class _Alloc>
+    inline bool
+    operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+_GLIBCXX_END_NAMESPACE_CONTAINER
+} // namespace std
+
+#endif /* _UNORDERED_SET_H */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_after.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_after.h
new file mode 100644
index 0000000..6440fae
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_after.h
@@ -0,0 +1,552 @@
+// The template and inlines for the -*- C++ -*- internal _Meta class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/valarray_after.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  //
+  // 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, bool>(_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, _UName)                       \
+  template<class _Dom>                                                   \
+    inline _Expr<_UnClos<_UName, _Expr, _Dom>,                           \
+                 typename _Dom::value_type>                              \
+    _Name(const _Expr<_Dom, typename _Dom::value_type>& __e)             \
+    {                                                                    \
+      typedef typename _Dom::value_type _Tp;                             \
+      typedef _UnClos<_UName, _Expr, _Dom> _Closure;                     \
+      return _Expr<_Closure, _Tp>(_Closure(__e()));                      \
+    }                                                                    \
+                                                                         \
+  template<typename _Tp>                                                 \
+    inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp>                   \
+    _Name(const valarray<_Tp>& __v)                                      \
+    {                                                                    \
+      typedef _UnClos<_UName, _ValArray, _Tp> _Closure;                  \
+      return _Expr<_Closure, _Tp>(_Closure(__v));                        \
+    }
+
+    _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
+    _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos)
+    _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos)
+    _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh)
+    _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin)
+    _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin)
+    _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh)
+    _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan)
+    _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh)
+    _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan)
+    _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp)
+    _DEFINE_EXPR_UNARY_FUNCTION(log, _Log)
+    _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10)
+    _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt)
+
+#undef _DEFINE_EXPR_UNARY_FUNCTION
+
+#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun, _UFun)		       \
+  template<class _Dom1, class _Dom2>                                   \
+    inline _Expr<_BinClos<_UFun, _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<_UFun, _Expr, _Expr, _Dom1, _Dom2> _Closure;    \
+      return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2()));           \
+    }                                                                  \
+                                                                       \
+  template<class _Dom>                                                 \
+    inline _Expr<_BinClos<_UFun, _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<_UFun, _Expr, _ValArray, _Dom, _Tp> _Closure;   \
+      return _Expr<_Closure, _Tp>(_Closure(__e(), __v));               \
+    }                                                                  \
+                                                                       \
+  template<class _Dom>                                                 \
+    inline _Expr<_BinClos<_UFun, _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<_UFun, _ValArray, _Expr, _Tp, _Dom> _Closure;   \
+      return _Expr<_Closure, _Tp>(_Closure(__v, __e()));               \
+    }                                                                  \
+                                                                       \
+  template<class _Dom>                                                 \
+    inline _Expr<_BinClos<_UFun, _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<_UFun, _Expr, _Constant, _Dom, _Tp> _Closure;   \
+      return _Expr<_Closure, _Tp>(_Closure(__e(), __t));               \
+    }                                                                  \
+                                                                       \
+  template<class _Dom>                                                 \
+    inline _Expr<_BinClos<_UFun, _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<_UFun, _Constant, _Expr, _Tp, _Dom> _Closure;   \
+      return _Expr<_Closure, _Tp>(_Closure(__t, __e()));               \
+    }                                                                  \
+                                                                       \
+  template<typename _Tp>                                               \
+    inline _Expr<_BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \
+    _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w)           \
+    {                                                                  \
+      typedef _BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp> _Closure;\
+      return _Expr<_Closure, _Tp>(_Closure(__v, __w));                 \
+    }                                                                  \
+                                                                       \
+  template<typename _Tp>                                               \
+    inline _Expr<_BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \
+    _Fun(const valarray<_Tp>& __v, const _Tp& __t)                     \
+    {                                                                  \
+      typedef _BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp> _Closure;\
+      return _Expr<_Closure, _Tp>(_Closure(__v, __t));                 \
+    }                                                                  \
+								       \
+  template<typename _Tp>                                               \
+    inline _Expr<_BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \
+    _Fun(const _Tp& __t, const valarray<_Tp>& __v)                     \
+    {                                                                  \
+      typedef _BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp> _Closure;\
+      return _Expr<_Closure, _Tp>(_Closure(__t, __v));                 \
+    }
+
+_DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2)
+_DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
+
+#undef _DEFINE_EXPR_BINARY_FUNCTION
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _CPP_VALARRAY_AFTER_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.h
new file mode 100644
index 0000000..cba9f3f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.h
@@ -0,0 +1,695 @@
+// The template and inlines for the -*- C++ -*- internal _Array helper class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/valarray_array.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  //
+  // 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* __b, _Tp* __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* __b, _Tp* __e)
+      { __builtin_memset(__b, 0, (__e - __b) * sizeof(_Tp)); }
+    };
+
+  template<typename _Tp>
+    inline void
+    __valarray_default_construct(_Tp* __b, _Tp* __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* __b, _Tp* __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* __b, _Tp* __e, const _Tp __t)
+      {
+	while (__b != __e)
+	  *__b++ = __t;
+      }
+    };
+
+  template<typename _Tp>
+    inline void
+    __valarray_fill_construct(_Tp* __b, _Tp* __e, const _Tp __t)
+    {
+      _Array_init_ctor<_Tp, __is_trivial(_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* __b, const _Tp* __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* __b, const _Tp* __e, _Tp* __restrict__ __o)
+      { __builtin_memcpy(__o, __b, (__e - __b) * sizeof(_Tp)); }
+    };
+
+  template<typename _Tp>
+    inline void
+    __valarray_copy_construct(const _Tp* __b, const _Tp* __e,
+			      _Tp* __restrict__ __o)
+    {
+      _Array_copy_ctor<_Tp, __is_trivial(_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_trivial(_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_trivial(_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* __b, _Tp* __e)
+    {
+      if (!__is_trivial(_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_trivial(_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* __f, const _Tp* __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* __f, const _Tp* __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_VERSION
+} // namespace
+
+# include <bits/valarray_array.tcc>
+
+#endif /* _ARRAY_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.tcc
new file mode 100644
index 0000000..7720707
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.tcc
@@ -0,0 +1,245 @@
+// The template and inlines for the -*- C++ -*- internal _Array helper class.
+
+// Copyright (C) 1997, 1998, 1999, 2003, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/valarray_array.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _VALARRAY_ARRAY_TCC
+#define _VALARRAY_ARRAY_TCC 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif /* _VALARRAY_ARRAY_TCC */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_before.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_before.h
new file mode 100644
index 0000000..0755f76
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_before.h
@@ -0,0 +1,734 @@
+// The template and inlines for the -*- C++ -*- internal _Meta class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/valarray_before.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{valarray}
+ */
+
+// 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  //
+  // 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_VERSION
+} // namespace
+
+#endif /* _CPP_VALARRAY_BEFORE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/vector.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/vector.tcc
new file mode 100644
index 0000000..cd23f76
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/vector.tcc
@@ -0,0 +1,788 @@
+// Vector implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 bits/vector.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{vector}
+ */
+
+#ifndef _VECTOR_TCC
+#define _VECTOR_TCC 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  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 (__first != __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 __google_stl_debug_dangling_vector
+      if (!this->_M_is_valid() || !__x._M_is_valid())
+	__throw_logic_error("operator=() on corrupt (dangling?) vector");
+#endif
+      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;
+	    }
+	}
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp, typename _Alloc>
+    void
+    vector<_Tp, _Alloc>::
+    _M_default_append(size_type __n)
+    {
+      if (__n != 0)
+	{
+	  if (size_type(this->_M_impl._M_end_of_storage
+			- this->_M_impl._M_finish) >= __n)
+	    {
+	      std::__uninitialized_default_n_a(this->_M_impl._M_finish,
+					       __n, _M_get_Tp_allocator());
+	      this->_M_impl._M_finish += __n;
+	    }
+	  else
+	    {
+	      const size_type __len =
+		_M_check_len(__n, "vector::_M_default_append");
+	      const size_type __old_size = this->size();
+	      pointer __new_start(this->_M_allocate(__len));
+	      pointer __new_finish(__new_start);
+	      __try
+		{
+		  __new_finish =
+		    std::__uninitialized_move_a(this->_M_impl._M_start,
+						this->_M_impl._M_finish,
+						__new_start,
+						_M_get_Tp_allocator());
+		  std::__uninitialized_default_n_a(__new_finish, __n,
+						   _M_get_Tp_allocator());
+		  __new_finish += __n;
+		}
+	      __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;
+	    }
+	}
+    }
+#endif
+
+  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_NAMESPACE_CONTAINER
+} // namespace std
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _Alloc>
+    size_t
+    hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>::
+    operator()(const _GLIBCXX_STD_C::vector<bool, _Alloc>& __b) const noexcept
+    {
+      size_t __hash = 0;
+      using _GLIBCXX_STD_C::_S_word_bit;
+      using _GLIBCXX_STD_C::_Bit_type;
+
+      const size_t __words = __b.size() / _S_word_bit;
+      if (__words)
+	{
+	  const size_t __clength = __words * sizeof(_Bit_type);
+	  __hash = std::_Hash_impl::hash(__b._M_impl._M_start._M_p, __clength);
+	}
+
+      const size_t __extrabits = __b.size() % _S_word_bit;
+      if (__extrabits)
+	{
+	  _Bit_type __hiword = *__b._M_impl._M_finish._M_p;
+	  __hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits);
+
+	  const size_t __clength
+	    = (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__;
+	  if (__words)
+	    __hash = std::_Hash_impl::hash(&__hiword, __clength, __hash);
+	  else
+	    __hash = std::_Hash_impl::hash(&__hiword, __clength);
+	}
+
+      return __hash;
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif /* _VECTOR_TCC */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bitset b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bitset
new file mode 100644
index 0000000..ee771be
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/bitset
@@ -0,0 +1,1578 @@
+// <bitset> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 <string>
+#include <bits/functexcept.h>   // For invalid_argument, out_of_range,
+                                // overflow_error
+#include <iosfwd>
+#include <bits/cxxabi_forced.h>
+
+#define _GLIBCXX_BITSET_BITS_PER_WORD  (__CHAR_BIT__ * __SIZEOF_LONG__)
+#define _GLIBCXX_BITSET_WORDS(__n) \
+  ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
+   ((__n) % _GLIBCXX_BITSET_BITS_PER_WORD == 0 ? 0 : 1))
+
+#define _GLIBCXX_BITSET_BITS_PER_ULL (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+
+  /**
+   *  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];
+
+      _GLIBCXX_CONSTEXPR _Base_bitset()
+      : _M_w() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr _Base_bitset(unsigned long long __val)
+      : _M_w({ _WordT(__val)
+#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
+	       , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD)
+#endif
+       }) { }
+#else
+      _Base_bitset(unsigned long __val)
+      : _M_w()
+      { _M_w[0] = __val; }
+#endif
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichword(size_t __pos )
+      { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichbyte(size_t __pos )
+      { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichbit(size_t __pos )
+      { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+      static _GLIBCXX_CONSTEXPR _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)]; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      const _WordT*
+      _M_getdata() const
+      { return _M_w; }
+#endif
+
+      _WordT&
+      _M_hiword()
+      { return _M_w[_Nw - 1]; }
+
+      _GLIBCXX_CONSTEXPR _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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      unsigned long long
+      _M_do_to_ullong() const;
+#endif
+
+      // 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];
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<size_t _Nw>
+    unsigned long long
+    _Base_bitset<_Nw>::_M_do_to_ullong() const
+    {
+      const bool __dw = sizeof(unsigned long long) > sizeof(unsigned long);
+      for (size_t __i = 1 + __dw; __i < _Nw; ++__i)
+	if (_M_w[__i])
+	  __throw_overflow_error(__N("_Base_bitset::_M_do_to_ullong"));
+
+      if (__dw)
+	return _M_w[0] + (static_cast<unsigned long long>(_M_w[1])
+			  << _GLIBCXX_BITSET_BITS_PER_WORD);
+      return _M_w[0];
+    }
+#endif
+
+  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;
+
+      _GLIBCXX_CONSTEXPR _Base_bitset()
+      : _M_w(0)
+      { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr _Base_bitset(unsigned long long __val)
+#else
+      _Base_bitset(unsigned long __val)
+#endif
+      : _M_w(__val)
+      { }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichword(size_t __pos )
+      { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichbyte(size_t __pos )
+      { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichbit(size_t __pos )
+      {  return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+      static _GLIBCXX_CONSTEXPR _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; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      const _WordT*
+      _M_getdata() const
+      { return &_M_w; }
+#endif
+
+      _WordT&
+      _M_hiword()
+      { return _M_w; }
+
+      _GLIBCXX_CONSTEXPR _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; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      unsigned long long
+      _M_do_to_ullong() const
+      { return _M_w; }
+#endif
+
+      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;
+
+      _GLIBCXX_CONSTEXPR _Base_bitset()
+      { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr _Base_bitset(unsigned long long)
+#else
+      _Base_bitset(unsigned long)
+#endif
+      { }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichword(size_t __pos )
+      { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichbyte(size_t __pos )
+      { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
+
+      static _GLIBCXX_CONSTEXPR size_t
+      _S_whichbit(size_t __pos )
+      {  return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+      static _GLIBCXX_CONSTEXPR _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)
+      { 
+	__throw_out_of_range(__N("_Base_bitset::_M_getword")); 
+	return *new _WordT; 
+      }
+
+      _WordT
+      _M_getword(size_t __pos) const
+      { return 0; }
+
+      _GLIBCXX_CONSTEXPR _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; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      unsigned long long
+      _M_do_to_ullong() const
+      { return 0; }
+#endif
+
+      // 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
+    {
+      typedef unsigned long _WordT;
+
+      static void 
+      _S_do_sanitize(_WordT& __val)
+      { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
+    };
+
+  template<>
+    struct _Sanitize<0>
+    { 
+      typedef unsigned long _WordT;
+
+      static void 
+      _S_do_sanitize(_WordT) { } 
+    };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<size_t _Nb, bool = _Nb < _GLIBCXX_BITSET_BITS_PER_ULL>
+    struct _Sanitize_val
+    {
+      static constexpr unsigned long long
+      _S_do_sanitize_val(unsigned long long __val)
+      { return __val; }
+    };
+
+  template<size_t _Nb>
+    struct _Sanitize_val<_Nb, true>
+    {
+      static constexpr unsigned long long
+      _S_do_sanitize_val(unsigned long long __val)
+      { return __val & ~((~static_cast<unsigned long long>(0)) << _Nb); }
+    };
+#endif
+
+  /**
+   *  @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 <em>a simple array of bits</em>, 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 <em>least significant / right-hand</em> position, and the bit at
+   *  index Nb-1 in the <em>most significant / left-hand</em> position.
+   *  Thus, unlike other containers, a %bitset's index <em>counts from
+   *  right to left</em>, 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
+   *  <em>b(&apos;a&apos;) is 0001100001</em> 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()
+      { 
+	typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
+	__sanitize_type::_S_do_sanitize(this->_M_hiword());
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename> friend class hash;
+#endif
+
+    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 <em>bit %reference</em> 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.
+      _GLIBCXX_CONSTEXPR bitset()
+      { }
+
+      /// Initial bits bitwise-copied from a single word (others set to zero).
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr bitset(unsigned long long __val)
+      : _Base(_Sanitize_val<_Nb>::_S_do_sanitize_val(__val)) { }
+#else
+      bitset(unsigned long __val)
+      : _Base(__val)
+      { _M_do_sanitize(); }
+#endif
+
+      /**
+       *  @brief  Use a subset of a string.
+       *  @param  s  A string of @a 0 and @a 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 @a 0 nor @a 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 @a 0 and @a 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 @a 0 nor @a 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);
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Construct from a character %array.
+       *  @param  str  An %array of characters @a zero and @a one.
+       *  @param  n    The number of characters to use.
+       *  @param  zero The character corresponding to the value 0.
+       *  @param  one  The character corresponding to the value 1.
+       *  @throw  std::invalid_argument  If a character appears in the string
+       *                                 which is neither @a zero nor @a one.
+       */
+      template<typename _CharT>
+        explicit
+        bitset(const _CharT* __str,
+	       typename std::basic_string<_CharT>::size_type __n
+	       = std::basic_string<_CharT>::npos,
+	       _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
+        : _Base()
+        {
+	  if (!__str)
+	    __throw_logic_error(__N("bitset::bitset(const _CharT*, ...)"));
+
+	  if (__n == std::basic_string<_CharT>::npos)
+	    __n = std::char_traits<_CharT>::length(__str);
+	  _M_copy_from_ptr<_CharT, std::char_traits<_CharT>>(__str, __n, 0,
+							     __n, __zero,
+							     __one);
+	}
+#endif
+
+      // 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 <em>const %bitset</em>.  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(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      unsigned long long
+      to_ullong() const
+      { return this->_M_do_to_ullong(); }
+#endif
+
+      /**
+       *  @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.
+      _GLIBCXX_CONSTEXPR 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 @a 0 and @a 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_NAMESPACE_CONTAINER
+} // namespace std
+
+#undef _GLIBCXX_BITSET_WORDS
+#undef _GLIBCXX_BITSET_BITS_PER_WORD
+#undef _GLIBCXX_BITSET_BITS_PER_ULL
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // DR 1182.
+  /// std::hash specialization for bitset.
+  template<size_t _Nb>
+    struct hash<_GLIBCXX_STD_C::bitset<_Nb>>
+    : public __hash_base<size_t, _GLIBCXX_STD_C::bitset<_Nb>>
+    {
+      size_t
+      operator()(const _GLIBCXX_STD_C::bitset<_Nb>& __b) const noexcept
+      {
+	const size_t __clength = (_Nb + __CHAR_BIT__ - 1) / __CHAR_BIT__;
+	return std::_Hash_impl::hash(__b._M_getdata(), __clength);
+      }
+    };
+
+  template<>
+    struct hash<_GLIBCXX_STD_C::bitset<0>>
+    : public __hash_base<size_t, _GLIBCXX_STD_C::bitset<0>>
+    {
+      size_t
+      operator()(const _GLIBCXX_STD_C::bitset<0>&) const noexcept
+      { return 0; }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/bitset>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/bitset>
+#endif
+
+#endif /* _GLIBCXX_BITSET */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cassert b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cassert
new file mode 100644
index 0000000..dc8af68
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cassert
@@ -0,0 +1,45 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ccomplex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ccomplex
new file mode 100644
index 0000000..b1117e8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ccomplex
@@ -0,0 +1,44 @@
+// <ccomplex> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cctype b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cctype
new file mode 100644
index 0000000..0fed691
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cctype
@@ -0,0 +1,96 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+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;
+} // namespace std
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
+
+#undef isblank
+
+namespace std
+{
+  using ::isblank;
+} // namespace std
+
+#endif // _GLIBCXX_USE_C99_CTYPE_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cerrno b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cerrno
new file mode 100644
index 0000000..0451cd9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cerrno
@@ -0,0 +1,53 @@
+// The -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfenv b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfenv
new file mode 100644
index 0000000..35010a0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfenv
@@ -0,0 +1,84 @@
+// <cfenv> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+
+#if _GLIBCXX_HAVE_FENV_H
+# include <fenv.h>
+#endif
+
+#ifdef _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
+{
+  // 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;
+} // namespace std
+
+#endif // _GLIBCXX_USE_C99_FENV_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CFENV
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfloat b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfloat
new file mode 100644
index 0000000..1be81d3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfloat
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/chrono b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/chrono
new file mode 100644
index 0000000..89ded2c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/chrono
@@ -0,0 +1,723 @@
+// <chrono> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <ratio>
+#include <type_traits>
+#include <limits>
+#include <ctime>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  /**
+   * @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
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    template<typename _Rep, typename _Period = ratio<1>>
+      struct duration;
+
+    template<typename _Clock, typename _Dur = typename _Clock::duration>
+      struct time_point;
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  }
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+  // 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>>
+    {
+    private:
+      typedef __static_gcd<_Period1::num, _Period2::num> 	__gcd_num;
+      typedef __static_gcd<_Period1::den, _Period2::den> 	__gcd_den;
+      typedef typename common_type<_Rep1, _Rep2>::type		__cr;
+      typedef ratio<__gcd_num::value,
+		    (_Period1::den / __gcd_den::value) * _Period2::den> __r;
+
+    public:
+      typedef chrono::duration<__cr, __r> 			type;
+    };
+
+  // 20.8.2.3 specialization of common_type (for time_point)
+  template<typename _Clock, typename _Dur1, typename _Dur2>
+    struct common_type<chrono::time_point<_Clock, _Dur1>,
+		       chrono::time_point<_Clock, _Dur2>>
+    {
+    private:
+      typedef typename common_type<_Dur1, _Dur2>::type 		__ct;
+
+    public:
+      typedef chrono::time_point<_Clock, __ct> 			type;
+    };
+_GLIBCXX_END_NAMESPACE_VERSION
+
+  namespace chrono
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    // Primary template for duration_cast impl.
+    template<typename _ToDur, typename _CF, typename _CR,
+	     bool _NumIsOne = false, bool _DenIsOne = false>
+      struct __duration_cast_impl
+      {
+	template<typename _Rep, typename _Period>
+	  static constexpr _ToDur
+	  __cast(const duration<_Rep, _Period>& __d)
+	  {
+	    typedef typename _ToDur::rep			__to_rep;
+	    return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count())
+	      * static_cast<_CR>(_CF::num)
+	      / static_cast<_CR>(_CF::den)));
+	  }
+      };
+
+    template<typename _ToDur, typename _CF, typename _CR>
+      struct __duration_cast_impl<_ToDur, _CF, _CR, true, true>
+      {
+	template<typename _Rep, typename _Period>
+	  static constexpr _ToDur
+	  __cast(const duration<_Rep, _Period>& __d)
+	  {
+	    typedef typename _ToDur::rep			__to_rep;
+	    return _ToDur(static_cast<__to_rep>(__d.count()));
+	  }
+      };
+
+    template<typename _ToDur, typename _CF, typename _CR>
+      struct __duration_cast_impl<_ToDur, _CF, _CR, true, false>
+      {
+	template<typename _Rep, typename _Period>
+	  static constexpr _ToDur
+	  __cast(const duration<_Rep, _Period>& __d)
+	  {
+	    typedef typename _ToDur::rep			__to_rep;
+	    return _ToDur(static_cast<__to_rep>(
+	      static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
+	  }
+      };
+
+    template<typename _ToDur, typename _CF, typename _CR>
+      struct __duration_cast_impl<_ToDur, _CF, _CR, false, true>
+      {
+	template<typename _Rep, typename _Period>
+	  static constexpr _ToDur
+	  __cast(const duration<_Rep, _Period>& __d)
+	  {
+	    typedef typename _ToDur::rep			__to_rep;
+	    return _ToDur(static_cast<__to_rep>(
+	      static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
+	  }
+      };
+
+    template<typename _Tp>
+      struct __is_duration
+      : std::false_type
+      { };
+
+    template<typename _Rep, typename _Period>
+      struct __is_duration<duration<_Rep, _Period>>
+      : std::true_type
+      { };
+
+    /// duration_cast
+    template<typename _ToDur, typename _Rep, typename _Period>
+      inline constexpr typename enable_if<__is_duration<_ToDur>::value,
+				_ToDur>::type
+      duration_cast(const duration<_Rep, _Period>& __d)
+      {
+	typedef typename _ToDur::period				__to_period;
+	typedef typename _ToDur::rep				__to_rep;
+	typedef ratio_divide<_Period, __to_period> 		__r_div;
+	typedef typename __r_div::type 				__cf;
+	typedef typename common_type<__to_rep, _Rep, intmax_t>::type
+	  							__cr;
+	typedef  __duration_cast_impl<_ToDur, __cf, __cr,
+				      __cf::num == 1, __cf::den == 1> __dc;
+	return __dc::__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 constexpr _Rep
+	zero()
+	{ return _Rep(0); }
+
+	static constexpr _Rep
+	max()
+	{ return numeric_limits<_Rep>::max(); }
+
+	static constexpr _Rep
+	min()
+	{ return numeric_limits<_Rep>::min(); }
+      };
+
+    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
+      {
+	typedef _Rep						rep;
+	typedef _Period 					period;
+
+	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");
+
+	// 20.8.3.1 construction / copy / destroy
+	constexpr duration() : __r() { }
+
+	constexpr duration(const duration&) = default;
+
+	template<typename _Rep2, typename = typename
+	       enable_if<is_convertible<_Rep2, rep>::value
+			 && (treat_as_floating_point<rep>::value
+			     || !treat_as_floating_point<_Rep2>::value)>::type>
+	  constexpr explicit duration(const _Rep2& __rep)
+	  : __r(static_cast<rep>(__rep)) { }
+
+	template<typename _Rep2, typename _Period2, typename = typename
+	       enable_if<treat_as_floating_point<rep>::value
+			 || (ratio_divide<_Period2, period>::type::den == 1
+			     && !treat_as_floating_point<_Rep2>::value)>::type>
+	  constexpr duration(const duration<_Rep2, _Period2>& __d)
+	  : __r(duration_cast<duration>(__d).count()) { }
+
+	~duration() = default;
+	duration& operator=(const duration&) = default;
+
+	// 20.8.3.2 observer
+	constexpr rep
+	count() const
+	{ return __r; }
+
+	// 20.8.3.3 arithmetic
+	constexpr duration
+	operator+() const
+	{ return *this; }
+
+	constexpr 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;
+	}
+
+	// DR 934.
+	template<typename _Rep2 = rep>
+	  typename enable_if<!treat_as_floating_point<_Rep2>::value,
+			     duration&>::type
+	  operator%=(const rep& __rhs)
+	  {
+	    __r %= __rhs;
+	    return *this;
+	  }
+
+	template<typename _Rep2 = rep>
+	  typename enable_if<!treat_as_floating_point<_Rep2>::value,
+			     duration&>::type
+	  operator%=(const duration& __d)
+	  {
+	    __r %= __d.count();
+	    return *this;
+	  }
+
+	// 20.8.3.4 special values
+	static constexpr duration
+	zero()
+	{ return duration(duration_values<rep>::zero()); }
+
+	static constexpr duration
+	min()
+	{ return duration(duration_values<rep>::min()); }
+
+	static constexpr 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 duration<_Rep1, _Period1>			__dur1;
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<__dur1,__dur2>::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 duration<_Rep1, _Period1>			__dur1;
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<__dur1,__dur2>::type	__ct;
+	return __ct(__lhs) -= __rhs;
+      }
+
+    template<typename _Rep1, typename _Rep2, bool =
+	     is_convertible<_Rep2,
+			    typename common_type<_Rep1, _Rep2>::type>::value>
+      struct __common_rep_type { };
+
+    template<typename _Rep1, typename _Rep2>
+      struct __common_rep_type<_Rep1, _Rep2, true>
+      { typedef typename common_type<_Rep1, _Rep2>::type type; };
+
+    template<typename _Rep1, typename _Period, typename _Rep2>
+      inline duration<typename __common_rep_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_rep_type<_Rep2, _Rep1>::type, _Period>
+      operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
+      { return __d * __s; }
+
+    template<typename _Rep1, typename _Period, typename _Rep2>
+      inline duration<typename __common_rep_type<_Rep1, typename
+	enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::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 _Period1,
+	      typename _Rep2, typename _Period2>
+      inline typename common_type<_Rep1, _Rep2>::type
+      operator/(const duration<_Rep1, _Period1>& __lhs,
+		const duration<_Rep2, _Period2>& __rhs)
+      {
+	typedef duration<_Rep1, _Period1>			__dur1;
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<__dur1,__dur2>::type	__ct;
+	return __ct(__lhs).count() / __ct(__rhs).count();
+      }
+
+    // DR 934.
+    template<typename _Rep1, typename _Period, typename _Rep2>
+      inline duration<typename __common_rep_type<_Rep1, typename
+	enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::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 _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 duration<_Rep1, _Period1>			__dur1;
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<__dur1,__dur2>::type	__ct;
+	return __ct(__lhs) %= __rhs;
+      }
+
+    // comparisons
+    template<typename _Rep1, typename _Period1,
+	     typename _Rep2, typename _Period2>
+      inline constexpr bool
+      operator==(const duration<_Rep1, _Period1>& __lhs,
+		 const duration<_Rep2, _Period2>& __rhs)
+      {
+	typedef duration<_Rep1, _Period1>			__dur1;
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<__dur1,__dur2>::type	__ct;
+	return __ct(__lhs).count() == __ct(__rhs).count();
+      }
+
+    template<typename _Rep1, typename _Period1,
+	     typename _Rep2, typename _Period2>
+      inline constexpr bool
+      operator<(const duration<_Rep1, _Period1>& __lhs,
+		const duration<_Rep2, _Period2>& __rhs)
+      {
+	typedef duration<_Rep1, _Period1>			__dur1;
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<__dur1,__dur2>::type	__ct;
+	return __ct(__lhs).count() < __ct(__rhs).count();
+      }
+
+    template<typename _Rep1, typename _Period1,
+	     typename _Rep2, typename _Period2>
+      inline constexpr 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 constexpr 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 constexpr 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 constexpr 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 _Dur>
+      struct time_point
+      {
+	typedef _Clock			  			clock;
+	typedef _Dur		  				duration;
+	typedef typename duration::rep	  			rep;
+	typedef typename duration::period			period;
+
+	constexpr time_point() : __d(duration::zero())
+	{ }
+
+	constexpr explicit time_point(const duration& __dur)
+	: __d(__dur)
+	{ }
+
+	// conversions
+	template<typename _Dur2>
+	  constexpr time_point(const time_point<clock, _Dur2>& __t)
+	  : __d(__t.time_since_epoch())
+	  { }
+
+	// observer
+	constexpr 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
+	static constexpr time_point
+	min()
+	{ return time_point(duration::min()); }
+
+	static constexpr time_point
+	max()
+	{ return time_point(duration::max()); }
+
+      private:
+	duration __d;
+      };
+
+    /// time_point_cast
+    template<typename _ToDur, typename _Clock, typename _Dur>
+      inline constexpr typename enable_if<__is_duration<_ToDur>::value,
+				time_point<_Clock, _ToDur>>::type
+      time_point_cast(const time_point<_Clock, _Dur>& __t)
+      {
+	typedef time_point<_Clock, _ToDur> 			__time_point;
+	return __time_point(duration_cast<_ToDur>(__t.time_since_epoch()));
+      }
+
+    template<typename _Clock, typename _Dur1,
+	     typename _Rep2, typename _Period2>
+      inline time_point<_Clock,
+	typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
+      operator+(const time_point<_Clock, _Dur1>& __lhs,
+		const duration<_Rep2, _Period2>& __rhs)
+      {
+	typedef duration<_Rep2, _Period2>			__dur2;
+	typedef typename common_type<_Dur1,__dur2>::type	__ct;
+	typedef time_point<_Clock, __ct> 			__time_point;
+	return __time_point(__lhs) += __rhs;
+      }
+
+    template<typename _Rep1, typename _Period1,
+	     typename _Clock, typename _Dur2>
+      inline time_point<_Clock,
+	typename common_type<duration<_Rep1, _Period1>, _Dur2>::type>
+      operator+(const duration<_Rep1, _Period1>& __lhs,
+		const time_point<_Clock, _Dur2>& __rhs)
+      { return __rhs + __lhs; }
+
+    template<typename _Clock, typename _Dur1,
+	     typename _Rep2, typename _Period2>
+      inline time_point<_Clock,
+	typename common_type<_Dur1, duration<_Rep2, _Period2>>::type>
+      operator-(const time_point<_Clock, _Dur1>& __lhs,
+		const duration<_Rep2, _Period2>& __rhs)
+      { return __lhs + (-__rhs); }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline typename common_type<_Dur1, _Dur2>::type
+      operator-(const time_point<_Clock, _Dur1>& __lhs,
+		const time_point<_Clock, _Dur2>& __rhs)
+      { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline constexpr bool
+      operator==(const time_point<_Clock, _Dur1>& __lhs,
+		 const time_point<_Clock, _Dur2>& __rhs)
+      { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline constexpr bool
+      operator!=(const time_point<_Clock, _Dur1>& __lhs,
+		 const time_point<_Clock, _Dur2>& __rhs)
+      { return !(__lhs == __rhs); }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline constexpr bool
+      operator<(const time_point<_Clock, _Dur1>& __lhs,
+		const time_point<_Clock, _Dur2>& __rhs)
+      { return  __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline constexpr bool
+      operator<=(const time_point<_Clock, _Dur1>& __lhs,
+		 const time_point<_Clock, _Dur2>& __rhs)
+      { return !(__rhs < __lhs); }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline constexpr bool
+      operator>(const time_point<_Clock, _Dur1>& __lhs,
+		const time_point<_Clock, _Dur2>& __rhs)
+      { return __rhs < __lhs; }
+
+    template<typename _Clock, typename _Dur1, typename _Dur2>
+      inline constexpr bool
+      operator>=(const time_point<_Clock, _Dur1>& __lhs,
+		 const time_point<_Clock, _Dur2>& __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_assert(system_clock::duration::min()
+		    < system_clock::duration::zero(),
+		    "a clock's minimum duration cannot be less than its epoch");
+
+      static constexpr bool is_monotonic = false;
+
+      static time_point
+      now() throw ();
+
+      // 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)
+      {
+	typedef chrono::time_point<system_clock, seconds>	__from;
+	return time_point_cast<system_clock::duration>
+	       (__from(chrono::seconds(__t)));
+      }
+    };
+
+#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 constexpr bool is_monotonic = true;
+
+      static time_point
+      now();
+    };
+#else
+    typedef system_clock monotonic_clock;
+#endif
+
+    typedef system_clock high_resolution_clock;
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace chrono
+
+  // @} group chrono
+} // namespace
+
+#endif //_GLIBCXX_USE_C99_STDINT_TR1
+
+#endif //__GXX_EXPERIMENTAL_CXX0X__
+
+#endif //_GLIBCXX_CHRONO
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cinttypes b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cinttypes
new file mode 100644
index 0000000..df73340
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cinttypes
@@ -0,0 +1,87 @@
+// <cinttypes> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#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
+
+#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
+
+namespace std
+{
+  // 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
+} // namespace std
+
+#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CINTTYPES
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ciso646 b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ciso646
new file mode 100644
index 0000000..55594ae
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ciso646
@@ -0,0 +1,34 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/climits b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/climits
new file mode 100644
index 0000000..f080fcb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/climits
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/clocale b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/clocale
new file mode 100644
index 0000000..3f16bff
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/clocale
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+namespace std
+{
+  using ::lconv;
+  using ::setlocale;
+  using ::localeconv;
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cmath b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cmath
new file mode 100644
index 0000000..6e8cd13
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cmath
@@ -0,0 +1,1647 @@
+// -*- C++ -*- C forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    abs(_Tp __x)
+    { return __builtin_fabs(__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<_Tp, _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<_Tp, _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_VERSION
+} // 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  inline int
+  fpclassify(float __x)
+  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
+				FP_SUBNORMAL, FP_ZERO, __x); }
+
+  inline int
+  fpclassify(double __x)
+  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
+				FP_SUBNORMAL, FP_ZERO, __x); }
+
+  inline int
+  fpclassify(long double __x)
+  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
+				FP_SUBNORMAL, FP_ZERO, __x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+					   int>::__type
+    fpclassify(_Tp __x)
+    { return __x != 0 ? FP_NORMAL : FP_ZERO; }
+
+  inline bool
+  isfinite(float __x)
+  { return __builtin_isfinite(__x); }
+
+  inline bool
+  isfinite(double __x)
+  { return __builtin_isfinite(__x); }
+
+  inline bool
+  isfinite(long double __x)
+  { return __builtin_isfinite(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+					   bool>::__type
+    isfinite(_Tp __x)
+    { return true; }
+
+  inline bool
+  isinf(float __x)
+  { return __builtin_isinf(__x); }
+
+  inline bool
+  isinf(double __x)
+  { return __builtin_isinf(__x); }
+
+  inline bool
+  isinf(long double __x)
+  { return __builtin_isinf(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+					   bool>::__type
+    isinf(_Tp __x)
+    { return false; }
+
+  inline bool
+  isnan(float __x)
+  { return __builtin_isnan(__x); }
+
+  inline bool
+  isnan(double __x)
+  { return __builtin_isnan(__x); }
+
+  inline bool
+  isnan(long double __x)
+  { return __builtin_isnan(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+					   bool>::__type
+    isnan(_Tp __x)
+    { return false; }
+
+  inline bool
+  isnormal(float __x)
+  { return __builtin_isnormal(__x); }
+
+  inline bool
+  isnormal(double __x)
+  { return __builtin_isnormal(__x); }
+
+  inline bool
+  isnormal(long double __x)
+  { return __builtin_isnormal(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+					   bool>::__type
+    isnormal(_Tp __x)
+    { return __x != 0 ? true : false; }
+
+  inline bool
+  signbit(float __x)
+  { return __builtin_signbit(__x); }
+
+  inline bool
+  signbit(double __x)
+  { return __builtin_signbit(__x); }
+
+  inline bool
+  signbit(long double __x)
+  { return __builtin_signbit(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+					   bool>::__type
+    signbit(_Tp __x)
+    { return __x < 0 ? true : false; }
+
+  inline bool
+  isgreater(float __x, float __y)
+  { return __builtin_isgreater(__x, __y); }
+
+  inline bool
+  isgreater(double __x, double __y)
+  { return __builtin_isgreater(__x, __y); }
+
+  inline bool
+  isgreater(long double __x, long double __y)
+  { return __builtin_isgreater(__x, __y); }
+
+  template<typename _Tp, typename _Up>
+    inline typename
+    __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
+			    && __is_arithmetic<_Up>::__value), bool>::__type
+    isgreater(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return __builtin_isgreater(__type(__x), __type(__y));
+    }
+
+  inline bool
+  isgreaterequal(float __x, float __y)
+  { return __builtin_isgreaterequal(__x, __y); }
+
+  inline bool
+  isgreaterequal(double __x, double __y)
+  { return __builtin_isgreaterequal(__x, __y); }
+
+  inline bool
+  isgreaterequal(long double __x, long double __y)
+  { return __builtin_isgreaterequal(__x, __y); }
+
+  template<typename _Tp, typename _Up>
+    inline typename
+    __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
+			    && __is_arithmetic<_Up>::__value), bool>::__type
+    isgreaterequal(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return __builtin_isgreaterequal(__type(__x), __type(__y));
+    }
+
+  inline bool
+  isless(float __x, float __y)
+  { return __builtin_isless(__x, __y); }
+
+  inline bool
+  isless(double __x, double __y)
+  { return __builtin_isless(__x, __y); }
+
+  inline bool
+  isless(long double __x, long double __y)
+  { return __builtin_isless(__x, __y); }
+
+  template<typename _Tp, typename _Up>
+    inline typename
+    __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
+			    && __is_arithmetic<_Up>::__value), bool>::__type
+    isless(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return __builtin_isless(__type(__x), __type(__y));
+    }
+
+  inline bool
+  islessequal(float __x, float __y)
+  { return __builtin_islessequal(__x, __y); }
+
+  inline bool
+  islessequal(double __x, double __y)
+  { return __builtin_islessequal(__x, __y); }
+
+  inline bool
+  islessequal(long double __x, long double __y)
+  { return __builtin_islessequal(__x, __y); }
+
+  template<typename _Tp, typename _Up>
+    inline typename
+    __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
+			    && __is_arithmetic<_Up>::__value), bool>::__type
+    islessequal(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return __builtin_islessequal(__type(__x), __type(__y));
+    }
+
+  inline bool
+  islessgreater(float __x, float __y)
+  { return __builtin_islessgreater(__x, __y); }
+
+  inline bool
+  islessgreater(double __x, double __y)
+  { return __builtin_islessgreater(__x, __y); }
+
+  inline bool
+  islessgreater(long double __x, long double __y)
+  { return __builtin_islessgreater(__x, __y); }
+
+  template<typename _Tp, typename _Up>
+    inline typename
+    __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
+			    && __is_arithmetic<_Up>::__value), bool>::__type
+    islessgreater(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return __builtin_islessgreater(__type(__x), __type(__y));
+    }
+
+  inline bool
+  isunordered(float __x, float __y)
+  { return __builtin_isunordered(__x, __y); }
+
+  inline bool
+  isunordered(double __x, double __y)
+  { return __builtin_isunordered(__x, __y); }
+
+  inline bool
+  isunordered(long double __x, long double __y)
+  { return __builtin_isunordered(__x, __y); }
+
+  template<typename _Tp, typename _Up>
+    inline typename
+    __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
+			    && __is_arithmetic<_Up>::__value), bool>::__type
+    isunordered(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return __builtin_isunordered(__type(__x), __type(__y));
+    }
+
+#else
+
+  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));
+    }
+
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#ifdef _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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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;
+
+  /// Additional overloads.
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    acosh(_Tp __x)
+    { return __builtin_acosh(__x); }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    asinh(_Tp __x)
+    { return __builtin_asinh(__x); }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    atanh(_Tp __x)
+    { return __builtin_atanh(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    cbrt(_Tp __x)
+    { return __builtin_cbrt(__x); }
+
+  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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _Up>::__type
+    copysign(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return copysign(__type(__x), __type(__y));
+    }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    erf(_Tp __x)
+    { return __builtin_erf(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    erfc(_Tp __x)
+    { return __builtin_erfc(__x); }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    exp2(_Tp __x)
+    { return __builtin_exp2(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    expm1(_Tp __x)
+    { return __builtin_expm1(__x); }
+
+  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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _Up>::__type
+    fdim(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return fdim(__type(__x), __type(__y));
+    }
+
+  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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value
+				    && __is_arithmetic<_Vp>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _Up>::__type
+    fmin(_Tp __x, _Up __y)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return fmin(__type(__x), __type(__y));
+    }
+
+  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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   int>::__type
+    ilogb(_Tp __x)
+    { return __builtin_ilogb(__x); }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    lgamma(_Tp __x)
+    { return __builtin_lgamma(__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 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long long>::__type
+    llrint(_Tp __x)
+    { return __builtin_llrint(__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 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+                                           long long>::__type
+    llround(_Tp __x)
+    { return __builtin_llround(__x); }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    log1p(_Tp __x)
+    { return __builtin_log1p(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    log2(_Tp __x)
+    { return __builtin_log2(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    logb(_Tp __x)
+    { return __builtin_logb(__x); }
+
+  inline long
+  lrint(float __x)
+  { return __builtin_lrintf(__x); }
+
+  inline long
+  lrint(long double __x)
+  { return __builtin_lrintl(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long>::__type
+    lrint(_Tp __x)
+    { return __builtin_lrint(__x); }
+
+  inline long
+  lround(float __x)
+  { return __builtin_lroundf(__x); }
+
+  inline long
+  lround(long double __x)
+  { return __builtin_lroundl(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long>::__type
+    lround(_Tp __x)
+    { return __builtin_lround(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    nearbyint(_Tp __x)
+    { return __builtin_nearbyint(__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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    nexttoward(_Tp __x, long double __y)
+    { return __builtin_nexttoward(__x, __y); }
+
+  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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    rint(_Tp __x)
+    { return __builtin_rint(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    round(_Tp __x)
+    { return __builtin_round(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    scalbln(_Tp __x, long __ex)
+    { return __builtin_scalbln(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    scalbn(_Tp __x, int __ex)
+    { return __builtin_scalbn(__x, __ex); }
+
+  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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    tgamma(_Tp __x)
+    { return __builtin_tgamma(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    trunc(_Tp __x)
+    { return __builtin_trunc(__x); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _GLIBCXX_USE_C99_MATH_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex
new file mode 100644
index 0000000..da3c469
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex
@@ -0,0 +1,1933 @@
+// 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, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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.
+      _GLIBCXX_CONSTEXPR 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>
+        _GLIBCXX_CONSTEXPR 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.
+      constexpr _Tp 
+      real() const { return _M_real; }
+
+      constexpr _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>&);
+
+      _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_CONSTEXPR bool
+    operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
+    { return __x.real() == __y.real() && __x.imag() == __y.imag(); }
+
+  template<typename _Tp>
+    inline _GLIBCXX_CONSTEXPR bool
+    operator==(const complex<_Tp>& __x, const _Tp& __y)
+    { return __x.real() == __y && __x.imag() == _Tp(); }
+
+  template<typename _Tp>
+    inline _GLIBCXX_CONSTEXPR 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 _GLIBCXX_CONSTEXPR bool
+    operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
+    { return __x.real() != __y.real() || __x.imag() != __y.imag(); }
+
+  template<typename _Tp>
+    inline _GLIBCXX_CONSTEXPR bool
+    operator!=(const complex<_Tp>& __x, const _Tp& __y)
+    { return __x.real() != __y || __x.imag() != _Tp(); }
+
+  template<typename _Tp>
+    inline _GLIBCXX_CONSTEXPR 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 constexpr _Tp
+    real(const complex<_Tp>& __z)
+    { return __z.real(); }
+    
+  template<typename _Tp>
+    inline constexpr _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__
+  template<typename _Tp>
+    complex<_Tp>
+    __complex_pow_unsigned(complex<_Tp> __x, unsigned __n)
+    {
+      complex<_Tp> __y = __n % 2 ? __x : complex<_Tp>(1);
+
+      while (__n >>= 1)
+        {
+          __x *= __x;
+          if (__n % 2)
+            __y *= __x;
+        }
+
+      return __y;
+    }
+
+  // _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 __n < 0
+        ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -__n)
+        : std::__complex_pow_unsigned(__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;
+
+      _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
+
+      _GLIBCXX_CONSTEXPR complex(float __r = 0.0f, float __i = 0.0f)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // The list-initialization extension to __complex__ types is
+      // not available in GCC 4.6.  Thus libstdc++/48760 cannot be
+      // fixed in C++0x mode, unfortunately.
+      : _M_value(__r + __i * 1.0fi) { }
+#else
+      {
+	__real__ _M_value = __r;
+	__imag__ _M_value = __i;
+      }
+#endif
+
+      explicit _GLIBCXX_CONSTEXPR complex(const complex<double>&);
+      explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);	
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 387. std::complex over-encapsulated.
+      constexpr float 
+      real() const { return __real__ _M_value; }
+
+      constexpr 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&
+      operator=(float __f)
+      {
+	_M_value = __f;
+	return *this;
+      }
+
+      complex&
+      operator+=(float __f)
+      {
+	_M_value += __f;
+	return *this;
+      }
+
+      complex&
+      operator-=(float __f)
+      {
+	_M_value -= __f;
+	return *this;
+      }
+
+      complex&
+      operator*=(float __f)
+      {
+	_M_value *= __f;
+	return *this;
+      }
+
+      complex&
+      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&
+        operator=(const complex<_Tp>&  __z)
+	{
+	  __real__ _M_value = __z.real();
+	  __imag__ _M_value = __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+        operator+=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value += __z.real();
+	  __imag__ _M_value += __z.imag();
+	  return *this;
+	}
+
+      template<class _Tp>
+        complex&
+        operator-=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value -= __z.real();
+	  __imag__ _M_value -= __z.imag();
+	  return *this;
+	}
+
+      template<class _Tp>
+        complex&
+        operator*=(const complex<_Tp>& __z)
+	{
+	  _ComplexT __t;
+	  __real__ __t = __z.real();
+	  __imag__ __t = __z.imag();
+	  _M_value *= __t;
+	  return *this;
+	}
+
+      template<class _Tp>
+        complex&
+        operator/=(const complex<_Tp>& __z)
+	{
+	  _ComplexT __t;
+	  __real__ __t = __z.real();
+	  __imag__ __t = __z.imag();
+	  _M_value /= __t;
+	  return *this;
+	}
+
+      _GLIBCXX_USE_CONSTEXPR _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;
+
+      _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
+
+      _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // The list-initialization extension to __complex__ types is
+      // not available in GCC 4.6.  Thus libstdc++/48760 cannot be
+      // fixed in C++0x mode, unfortunately.
+      : _M_value(__r + __i * 1.0i) { }
+#else
+      {
+	__real__ _M_value = __r;
+	__imag__ _M_value = __i;
+      }
+#endif
+
+      _GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
+      : _M_value(__z.__rep()) { }
+
+      explicit _GLIBCXX_CONSTEXPR complex(const complex<long double>&);	
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 387. std::complex over-encapsulated.
+      constexpr double 
+      real() const { return __real__ _M_value; }
+
+      constexpr 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&
+      operator=(double __d)
+      {
+	_M_value = __d;
+	return *this;
+      }
+
+      complex&
+      operator+=(double __d)
+      {
+	_M_value += __d;
+	return *this;
+      }
+	
+      complex&
+      operator-=(double __d)
+      {
+	_M_value -= __d;
+	return *this;
+      }
+
+      complex&
+      operator*=(double __d)
+      {
+	_M_value *= __d;
+	return *this;
+      }
+
+      complex&
+      operator/=(double __d)
+      {
+	_M_value /= __d;
+	return *this;
+      }
+
+      // The compiler will synthesize this, efficiently.
+      // complex& operator=(const complex&);
+
+      template<typename _Tp>
+        complex&
+        operator=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value = __z.real();
+	  __imag__ _M_value = __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+        operator+=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value += __z.real();
+	  __imag__ _M_value += __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+        operator-=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value -= __z.real();
+	  __imag__ _M_value -= __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+        operator*=(const complex<_Tp>& __z)
+	{
+	  _ComplexT __t;
+	  __real__ __t = __z.real();
+	  __imag__ __t = __z.imag();
+	  _M_value *= __t;
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+        operator/=(const complex<_Tp>& __z)
+	{
+	  _ComplexT __t;
+	  __real__ __t = __z.real();
+	  __imag__ __t = __z.imag();
+	  _M_value /= __t;
+	  return *this;
+	}
+
+      _GLIBCXX_USE_CONSTEXPR _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;
+
+      _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
+
+      _GLIBCXX_CONSTEXPR complex(long double __r = 0.0L, 
+				 long double __i = 0.0L)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // The list-initialization extension to __complex__ types is
+      // not available in GCC 4.6.  Thus libstdc++/48760 cannot be
+      // fixed in C++0x mode, unfortunately.
+      : _M_value(__r + __i * 1.0Li) { }
+#else
+      {
+	__real__ _M_value = __r;
+	__imag__ _M_value = __i;
+      }
+#endif
+
+      _GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
+      : _M_value(__z.__rep()) { }
+
+      _GLIBCXX_CONSTEXPR complex(const complex<double>& __z)
+      : _M_value(__z.__rep()) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // DR 387. std::complex over-encapsulated.
+      constexpr long double 
+      real() const { return __real__ _M_value; }
+
+      constexpr 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&
+      operator=(long double __r)
+      {
+	_M_value = __r;
+	return *this;
+      }
+
+      complex&
+      operator+=(long double __r)
+      {
+	_M_value += __r;
+	return *this;
+      }
+
+      complex&
+      operator-=(long double __r)
+      {
+	_M_value -= __r;
+	return *this;
+      }
+
+      complex&
+      operator*=(long double __r)
+      {
+	_M_value *= __r;
+	return *this;
+      }
+
+      complex&
+      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&
+        operator=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value = __z.real();
+	  __imag__ _M_value = __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+	operator+=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value += __z.real();
+	  __imag__ _M_value += __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+	operator-=(const complex<_Tp>& __z)
+	{
+	  __real__ _M_value -= __z.real();
+	  __imag__ _M_value -= __z.imag();
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+	operator*=(const complex<_Tp>& __z)
+	{
+	  _ComplexT __t;
+	  __real__ __t = __z.real();
+	  __imag__ __t = __z.imag();
+	  _M_value *= __t;
+	  return *this;
+	}
+
+      template<typename _Tp>
+        complex&
+	operator/=(const complex<_Tp>& __z)
+	{
+	  _ComplexT __t;
+	  __real__ __t = __z.real();
+	  __imag__ __t = __z.imag();
+	  _M_value /= __t;
+	  return *this;
+	}
+
+      _GLIBCXX_USE_CONSTEXPR _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 _GLIBCXX_CONSTEXPR
+  complex<float>::complex(const complex<double>& __z)
+  : _M_value(__z.__rep()) { }
+
+  inline _GLIBCXX_CONSTEXPR
+  complex<float>::complex(const complex<long double>& __z)
+  : _M_value(__z.__rep()) { }
+
+  inline _GLIBCXX_CONSTEXPR
+  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_VERSION
+} // namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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>&);
+  // DR 595.
+  template<typename _Tp> _Tp               fabs(const std::complex<_Tp>&);
+
+  template<typename _Tp>
+    inline std::complex<_Tp>
+    __complex_acos(const std::complex<_Tp>& __z)
+    {
+      const std::complex<_Tp> __t = std::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::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)
+    {
+      // Kahan's formula.
+      return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0)))
+				 + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
+    }
+
+#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>
+    inline _Tp
+    /// 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].
+  template<typename _Tp>
+    inline typename __gnu_cxx::__promote<_Tp>::__type
+    arg(_Tp __x)
+    {
+      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
+      return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
+	                       : __type();
+#else
+      return std::arg(std::complex<__type>(__x));
+#endif
+    }
+
+  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; }
+
+  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));
+    }
+
+  // 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
+
+  // DR 1137.
+  template<typename _Tp>
+    inline typename __gnu_cxx::__promote<_Tp>::__type
+    proj(_Tp __x)
+    { return __x; }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__promote<_Tp>::__type
+    conj(_Tp __x)
+    { return __x; }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif  // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif  /* _GLIBCXX_COMPLEX */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/complex.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/complex.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/condition_variable b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/condition_variable
new file mode 100644
index 0000000..ff65dc4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/condition_variable
@@ -0,0 +1,281 @@
+// <condition_variable> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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 <bits/c++0x_warning.h>
+#else
+
+#include <chrono>
+#include <mutex> // unique_lock
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup condition_variables Condition Variables
+   * @ingroup concurrency
+   *
+   * Classes for condition_variable support.
+   * @{
+   */
+
+  /// cv_status
+  enum class cv_status { no_timeout, timeout };
+  
+  /// 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() throw ();
+    ~condition_variable() throw ();
+
+    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>
+      cv_status
+      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>
+      cv_status
+      wait_until(unique_lock<mutex>& __lock,
+		 const chrono::time_point<_Clock, _Duration>& __atime)
+      {
+	// DR 887 - Sync unknown clock to known clock.
+	const typename _Clock::time_point __c_entry = _Clock::now();
+	const __clock_t::time_point __s_entry = __clock_t::now();
+	const chrono::nanoseconds __delta = __atime - __c_entry;
+	const __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) == cv_status::timeout)
+	    return __p();
+	return true;
+      }
+
+    template<typename _Rep, typename _Period>
+      cv_status
+      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>
+      cv_status
+      __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
+		? cv_status::no_timeout : cv_status::timeout);
+      }
+  };
+
+  /// condition_variable_any
+  // Like above, but mutex is not required to have try_lock.
+  class condition_variable_any
+  {
+    typedef chrono::system_clock	__clock_t;
+    condition_variable			_M_cond;
+    mutex				_M_mutex;
+
+  public:
+    typedef condition_variable::native_handle_type	native_handle_type;
+
+    condition_variable_any() throw ();
+    ~condition_variable_any() throw ();
+
+    condition_variable_any(const condition_variable_any&) = delete;
+    condition_variable_any& operator=(const condition_variable_any&) = delete;
+
+    void
+    notify_one()
+    {
+      lock_guard<mutex> __lock(_M_mutex);
+      _M_cond.notify_one();
+    }
+
+    void
+    notify_all()
+    {
+      lock_guard<mutex> __lock(_M_mutex);
+      _M_cond.notify_all();
+    }
+
+    template<typename _Lock>
+      void
+      wait(_Lock& __lock)
+      {
+	// scoped unlock - unlocks in ctor, re-locks in dtor
+	struct _Unlock {
+	  explicit _Unlock(_Lock& __lk) : _M_lock(__lk) { __lk.unlock(); }
+	  ~_Unlock() noexcept(false)
+	  {
+	    if (uncaught_exception())
+	      __try { _M_lock.lock(); } __catch(...) { }
+	    else
+	      _M_lock.lock();
+	  }
+	  _Lock& _M_lock;
+	};
+
+	unique_lock<mutex> __my_lock(_M_mutex);
+	_Unlock __unlock(__lock);
+	// _M_mutex must be unlocked before re-locking __lock so move
+	// ownership of _M_mutex lock to an object with shorter lifetime.
+	unique_lock<mutex> __my_lock2(std::move(__my_lock));
+	_M_cond.wait(__my_lock2);
+      }
+      
+
+    template<typename _Lock, typename _Predicate>
+      void
+      wait(_Lock& __lock, _Predicate __p)
+      {
+	while (!__p())
+	  wait(__lock);
+      }
+
+    template<typename _Lock, typename _Clock, typename _Duration>
+      cv_status
+      wait_until(_Lock& __lock,
+		 const chrono::time_point<_Clock, _Duration>& __atime)
+      {
+        unique_lock<mutex> __my_lock(_M_mutex);
+        __lock.unlock();
+        cv_status __status = _M_cond.wait_until(__my_lock, __atime);
+        __lock.lock();
+        return __status;
+      }
+
+    template<typename _Lock, typename _Clock,
+	     typename _Duration, typename _Predicate>
+      bool
+      wait_until(_Lock& __lock,
+		 const chrono::time_point<_Clock, _Duration>& __atime,
+		 _Predicate __p)
+      {
+	while (!__p())
+	  if (wait_until(__lock, __atime) == cv_status::timeout)
+	    return __p();
+	return true;
+      }
+
+    template<typename _Lock, typename _Rep, typename _Period>
+      cv_status
+      wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime)
+      { return wait_until(__lock, __clock_t::now() + __rtime); }
+
+    template<typename _Lock, typename _Rep,
+	     typename _Period, typename _Predicate>
+      bool
+      wait_for(_Lock& __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.native_handle(); }
+  };
+
+  // @} group condition_variables
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CONDITION_VARIABLE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/csetjmp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/csetjmp
new file mode 100644
index 0000000..2832801
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/csetjmp
@@ -0,0 +1,63 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+namespace std
+{
+  using ::jmp_buf;
+  using ::longjmp;
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/csignal b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/csignal
new file mode 100644
index 0000000..98f0d66
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/csignal
@@ -0,0 +1,59 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+namespace std
+{
+  using ::sig_atomic_t;
+  using ::signal;
+  using ::raise;
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdarg b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdarg
new file mode 100644
index 0000000..fb27389
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdarg
@@ -0,0 +1,59 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+namespace std
+{
+  using ::va_list;
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdbool b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdbool
new file mode 100644
index 0000000..dd428f2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdbool
@@ -0,0 +1,44 @@
+// <cstdbool> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+#  include <bits/c++config.h>
+#  if _GLIBCXX_HAVE_STDBOOL_H
+#    include <stdbool.h>
+#  endif
+#endif
+
+#endif 
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstddef b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstddef
new file mode 100644
index 0000000..d9a7383
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstddef
@@ -0,0 +1,44 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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>
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdint b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdint
new file mode 100644
index 0000000..ce8143e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdint
@@ -0,0 +1,106 @@
+// <cstdint> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#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
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std
+{
+  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;
+} // namespace std
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CSTDINT
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdio b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdio
new file mode 100644
index 0000000..049704d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdio
@@ -0,0 +1,185 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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 <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
+
+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;
+} // namespace
+
+#if _GLIBCXX_USE_C99
+
+#undef snprintf
+#undef vfscanf
+#undef vscanf
+#undef vsnprintf
+#undef vsscanf
+
+namespace __gnu_cxx
+{
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+  extern "C" int
+  (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...)
+  throw ();
+  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, std::size_t, const char * __restrict,
+	      __gnuc_va_list) throw ();
+  extern "C" int
+  (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list)
+  throw ();
+#endif
+
+#if !_GLIBCXX_USE_C99_DYNAMIC
+  using ::snprintf;
+  using ::vfscanf;
+  using ::vscanf;
+  using ::vsnprintf;
+  using ::vsscanf;
+#endif
+} // namespace __gnu_cxx
+
+namespace std
+{
+  using ::__gnu_cxx::snprintf;
+  using ::__gnu_cxx::vfscanf;
+  using ::__gnu_cxx::vscanf;
+  using ::__gnu_cxx::vsnprintf;
+  using ::__gnu_cxx::vsscanf;
+} // namespace std
+
+#endif // _GLIBCXX_USE_C99
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdlib b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdlib
new file mode 100644
index 0000000..aa7530d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdlib
@@ -0,0 +1,255 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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>
+
+#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
+
+namespace std
+{
+  extern "C" void abort(void) throw () _GLIBCXX_NORETURN;
+  extern "C" int atexit(void (*)()) throw ();
+  extern "C" void exit(int) throw () _GLIBCXX_NORETURN;
+} // namespace std
+
+#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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#if _GLIBCXX_USE_C99
+
+#undef _Exit
+#undef llabs
+#undef lldiv
+#undef atoll
+#undef strtoll
+#undef strtoull
+#undef strtof
+#undef strtold
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#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) throw () _GLIBCXX_NORETURN;
+#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 *) throw ();
+  extern "C" long long int
+    (strtoll)(const char * __restrict, char ** __restrict, int) throw ();
+  extern "C" unsigned long long int
+    (strtoull)(const char * __restrict, char ** __restrict, int) throw ();
+#endif
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+  using ::atoll;
+  using ::strtoll;
+  using ::strtoull;
+#endif
+  using ::strtof;
+  using ::strtold;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __gnu_cxx
+
+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;
+} // namespace std
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+namespace std
+{
+#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
+} // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_USE_C99
+
+#endif // !_GLIBCXX_HOSTED
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstring b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstring
new file mode 100644
index 0000000..ea33fa1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstring
@@ -0,0 +1,125 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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 <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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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* __s, int __c, size_t __n)
+  { return __builtin_memchr(__s, __c, __n); }
+
+  inline char*
+  strchr(char* __s, int __n)
+  { return __builtin_strchr(__s, __n); }
+
+  inline char*
+  strpbrk(char* __s1, const char* __s2)
+  { return __builtin_strpbrk(__s1, __s2); }
+
+  inline char*
+  strrchr(char* __s, int __n)
+  { return __builtin_strrchr(__s, __n); }
+
+  inline char*
+  strstr(char* __s1, const char* __s2)
+  { return __builtin_strstr(__s1, __s2); }
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctgmath b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctgmath
new file mode 100644
index 0000000..6b51005
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctgmath
@@ -0,0 +1,41 @@
+// <ctgmath> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+#  include <cmath>
+#endif
+
+#endif 
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctime b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctime
new file mode 100644
index 0000000..085e792
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctime
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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 <bits/c++config.h>
+#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
+
+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;
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwchar b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwchar
new file mode 100644
index 0000000..a2b1168
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwchar
@@ -0,0 +1,305 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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>
+
+#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
+
+namespace std
+{
+  using ::mbstate_t;
+} // namespace std
+
+// 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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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;
+#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
+  using ::swprintf;
+#endif
+  using ::swscanf;
+  using ::ungetwc;
+  using ::vfwprintf;
+#if _GLIBCXX_HAVE_VFWSCANF
+  using ::vfwscanf;
+#endif
+#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
+  using ::vswprintf;
+#endif
+#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_VERSION
+} // namespace
+
+#if _GLIBCXX_USE_C99
+
+#undef wcstold
+#undef wcstoll
+#undef wcstoull
+
+namespace __gnu_cxx
+{
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+  extern "C" long double
+    (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict) throw ();
+#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) throw ();
+  extern "C" unsigned long long int
+    (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw ();
+#endif
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+  using ::wcstoll;
+  using ::wcstoull;
+#endif
+} // namespace __gnu_cxx
+
+namespace std
+{
+  using ::__gnu_cxx::wcstold;
+  using ::__gnu_cxx::wcstoll;
+  using ::__gnu_cxx::wcstoull;
+} // namespace
+
+#endif
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+namespace std
+{
+#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
+} // namespace
+
+#endif // _GLIBCXX_USE_WCHAR_T
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwctype b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwctype
new file mode 100644
index 0000000..e417b68
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwctype
@@ -0,0 +1,127 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @a *.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
+
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10
+// Work around glibc BZ 9694
+#include <stddef.h>
+#endif
+
+#include <wctype.h>
+#endif // _GLIBCXX_HAVE_WCTYPE_H
+
+#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
+
+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;
+} // namespace
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+namespace std
+{
+#if _GLIBCXX_HAVE_ISWBLANK
+  using std::iswblank;
+#endif  
+} // namespace
+
+#endif // _GLIBCXX_USE_WCHAR_T
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CWCTYPE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cxxabi.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cxxabi.h
new file mode 100644
index 0000000..c93085a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/cxxabi.h
@@ -0,0 +1,626 @@
+// ABI Support -*- C++ -*-
+
+// Copyright (C) 2000, 2002, 2003, 2004, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com>
+
+/* This file declares the new abi entry points into the runtime. It is not
+   normally necessary for user programs to include this header, or use the
+   entry points directly. However, this header is available should that be
+   needed.
+
+   Some of the entry points are intended for both C and C++, thus this header
+   is includable from both C and C++. Though the C++ specific parts are not
+   available in C, naturally enough.  */
+
+/** @file cxxabi.h
+ *  The header provides an interface to the C++ ABI.
+ */
+
+#ifndef _CXXABI_H
+#define _CXXABI_H 1
+
+#pragma GCC system_header
+
+#pragma GCC visibility push(default)
+
+#include <stddef.h>
+#include <bits/c++config.h>
+#include <bits/cxxabi_tweaks.h>
+#include <bits/cxxabi_forced.h>
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{
+  extern "C"
+  {
+#endif
+
+  typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);
+
+  // Allocate array.
+  void*
+  __cxa_vec_new(size_t __element_count, size_t __element_size,
+		size_t __padding_size, __cxa_cdtor_type __constructor,
+		__cxa_cdtor_type __destructor);
+
+  void*
+  __cxa_vec_new2(size_t __element_count, size_t __element_size,
+		 size_t __padding_size, __cxa_cdtor_type __constructor,
+		 __cxa_cdtor_type __destructor, void *(*__alloc) (size_t),
+		 void (*__dealloc) (void*));
+
+  void*
+  __cxa_vec_new3(size_t __element_count, size_t __element_size,
+		 size_t __padding_size, __cxa_cdtor_type __constructor,
+		 __cxa_cdtor_type __destructor, void *(*__alloc) (size_t),
+		 void (*__dealloc) (void*, size_t));
+
+  // Construct array.
+  __cxa_vec_ctor_return_type
+  __cxa_vec_ctor(void* __array_address, size_t __element_count,
+		 size_t __element_size, __cxa_cdtor_type __constructor,
+		 __cxa_cdtor_type __destructor);
+
+  __cxa_vec_ctor_return_type
+  __cxa_vec_cctor(void* __dest_array, void* __src_array,
+		  size_t __element_count, size_t __element_size,
+		  __cxa_cdtor_return_type (*__constructor) (void*, void*),
+		  __cxa_cdtor_type __destructor);
+
+  // Destruct array.
+  void
+  __cxa_vec_dtor(void* __array_address, size_t __element_count,
+		 size_t __element_size, __cxa_cdtor_type __destructor);
+
+  void
+  __cxa_vec_cleanup(void* __array_address, size_t __element_count, size_t __s,
+		    __cxa_cdtor_type __destructor) _GLIBCXX_NOTHROW;
+
+  // Destruct and release array.
+  void
+  __cxa_vec_delete(void* __array_address, size_t __element_size,
+		   size_t __padding_size, __cxa_cdtor_type __destructor);
+
+  void
+  __cxa_vec_delete2(void* __array_address, size_t __element_size,
+		    size_t __padding_size, __cxa_cdtor_type __destructor,
+		    void (*__dealloc) (void*));
+
+  void
+  __cxa_vec_delete3(void* __array_address, size_t __element_size,
+		    size_t __padding_size, __cxa_cdtor_type __destructor,
+		    void (*__dealloc) (void*, size_t));
+
+  int
+  __cxa_guard_acquire(__guard*);
+
+  void
+  __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW;
+
+  void
+  __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW;
+
+  // Pure virtual functions.
+  void
+  __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
+
+  // Exception handling.
+  void
+  __cxa_bad_cast();
+
+  void
+  __cxa_bad_typeid();
+
+  // DSO destruction.
+  int
+  __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW;
+
+  int
+  __cxa_finalize(void*);
+
+
+  /**
+   *  @brief Demangling routine.
+   *  ABI-mandated entry point in the C++ runtime library for demangling.
+   *
+   *  @param __mangled_name A NUL-terminated character string
+   *  containing the name to be demangled.
+   *
+   *  @param __output_buffer A region of memory, allocated with
+   *  malloc, of @a *__length bytes, into which the demangled name is
+   *  stored.  If @a __output_buffer is not long enough, it is
+   *  expanded using realloc.  @a __output_buffer may instead be NULL;
+   *  in that case, the demangled name is placed in a region of memory
+   *  allocated with malloc.
+   *
+   *  @param __length If @a __length is non-NULL, the length of the
+   *  buffer containing the demangled name is placed in @a *__length.
+   *
+   *  @param __status @a *__status is set to one of the following values:
+   *   0: The demangling operation succeeded.
+   *  -1: A memory allocation failure occurred.
+   *  -2: @a mangled_name is not a valid name under the C++ ABI mangling rules.
+   *  -3: One of the arguments is invalid.
+   *
+   *  @return A pointer to the start of the NUL-terminated demangled
+   *  name, or NULL if the demangling fails.  The caller is
+   *  responsible for deallocating this memory using @c free.
+   *
+   *  The demangling is performed using the C++ ABI mangling rules,
+   *  with GNU extensions. For example, this function is used in
+   *  __gnu_cxx::__verbose_terminate_handler.
+   *
+   *  See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch39.html
+   *  for other examples of use.
+   *
+   *  @note The same demangling functionality is available via
+   *  libiberty (@c <libiberty/demangle.h> and @c libiberty.a) in GCC
+   *  3.1 and later, but that requires explicit installation (@c
+   *  --enable-install-libiberty) and uses a different API, although
+   *  the ABI is unchanged.
+   */
+  char*
+  __cxa_demangle(const char* __mangled_name, char* __output_buffer,
+		 size_t* __length, int* __status);
+#ifdef __cplusplus
+  }
+} // namespace __cxxabiv1
+#endif
+
+#ifdef __cplusplus
+
+#include <typeinfo>
+
+namespace __cxxabiv1
+{
+  // Type information for int, float etc.
+  class __fundamental_type_info : public std::type_info
+  {
+  public:
+    explicit
+    __fundamental_type_info(const char* __n) : std::type_info(__n) { }
+
+    virtual
+    ~__fundamental_type_info();
+  };
+
+  // Type information for array objects.
+  class __array_type_info : public std::type_info
+  {
+  public:
+    explicit
+    __array_type_info(const char* __n) : std::type_info(__n) { }
+
+    virtual
+    ~__array_type_info();
+  };
+
+  // Type information for functions (both member and non-member).
+  class __function_type_info : public std::type_info
+  {
+  public:
+    explicit
+    __function_type_info(const char* __n) : std::type_info(__n) { }
+
+    virtual
+    ~__function_type_info();
+
+  protected:
+    // Implementation defined member function.
+    virtual bool
+    __is_function_p() const;
+  };
+
+  // Type information for enumerations.
+  class __enum_type_info : public std::type_info
+  {
+  public:
+    explicit
+    __enum_type_info(const char* __n) : std::type_info(__n) { }
+
+    virtual
+    ~__enum_type_info();
+  };
+
+  // Common type information for simple pointers and pointers to member.
+  class __pbase_type_info : public std::type_info
+  {
+  public:
+    unsigned int 		__flags; // Qualification of the target object.
+    const std::type_info* 	__pointee; // Type of pointed to object.
+
+    explicit
+    __pbase_type_info(const char* __n, int __quals,
+		      const std::type_info* __type)
+    : std::type_info(__n), __flags(__quals), __pointee(__type)
+    { }
+
+    virtual
+    ~__pbase_type_info();
+
+    // Implementation defined type.
+    enum __masks
+      {
+	__const_mask = 0x1,
+	__volatile_mask = 0x2,
+	__restrict_mask = 0x4,
+	__incomplete_mask = 0x8,
+	__incomplete_class_mask = 0x10
+      };
+
+  protected:
+    __pbase_type_info(const __pbase_type_info&);
+
+    __pbase_type_info&
+    operator=(const __pbase_type_info&);
+
+    // Implementation defined member functions.
+    virtual bool
+    __do_catch(const std::type_info* __thr_type, void** __thr_obj,
+	       unsigned int __outer) const;
+
+    inline virtual bool
+    __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
+		    unsigned __outer) const;
+  };
+
+  // Type information for simple pointers.
+  class __pointer_type_info : public __pbase_type_info
+  {
+  public:
+    explicit
+    __pointer_type_info(const char* __n, int __quals,
+			const std::type_info* __type)
+    : __pbase_type_info (__n, __quals, __type) { }
+
+
+    virtual
+    ~__pointer_type_info();
+
+  protected:
+    // Implementation defined member functions.
+    virtual bool
+    __is_pointer_p() const;
+
+    virtual bool
+    __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
+		    unsigned __outer) const;
+  };
+
+  class __class_type_info;
+
+  // Type information for a pointer to member variable.
+  class __pointer_to_member_type_info : public __pbase_type_info
+  {
+  public:
+    __class_type_info* __context;   // Class of the member.
+
+    explicit
+    __pointer_to_member_type_info(const char* __n, int __quals,
+				  const std::type_info* __type,
+				  __class_type_info* __klass)
+    : __pbase_type_info(__n, __quals, __type), __context(__klass) { }
+
+    virtual
+    ~__pointer_to_member_type_info();
+
+  protected:
+    __pointer_to_member_type_info(const __pointer_to_member_type_info&);
+
+    __pointer_to_member_type_info&
+    operator=(const __pointer_to_member_type_info&);
+
+    // Implementation defined member function.
+    virtual bool
+    __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,
+		    unsigned __outer) const;
+  };
+
+  // Helper class for __vmi_class_type.
+  class __base_class_type_info
+  {
+  public:
+    const __class_type_info* 	__base_type;  // Base class type.
+    long 			__offset_flags;  // Offset and info.
+
+    enum __offset_flags_masks
+      {
+	__virtual_mask = 0x1,
+	__public_mask = 0x2,
+	__hwm_bit = 2,
+	__offset_shift = 8          // Bits to shift offset.
+      };
+
+    // Implementation defined member functions.
+    bool
+    __is_virtual_p() const
+    { return __offset_flags & __virtual_mask; }
+
+    bool
+    __is_public_p() const
+    { return __offset_flags & __public_mask; }
+
+    ptrdiff_t
+    __offset() const
+    {
+      // This shift, being of a signed type, is implementation
+      // defined. GCC implements such shifts as arithmetic, which is
+      // what we want.
+      return static_cast<ptrdiff_t>(__offset_flags) >> __offset_shift;
+    }
+  };
+
+  // Type information for a class.
+  class __class_type_info : public std::type_info
+  {
+  public:
+    explicit
+    __class_type_info (const char *__n) : type_info(__n) { }
+
+    virtual
+    ~__class_type_info ();
+
+    // Implementation defined types.
+    // The type sub_kind tells us about how a base object is contained
+    // within a derived object. We often do this lazily, hence the
+    // UNKNOWN value. At other times we may use NOT_CONTAINED to mean
+    // not publicly contained.
+    enum __sub_kind
+      {
+	// We have no idea.
+	__unknown = 0,
+
+	// Not contained within us (in some circumstances this might
+	// mean not contained publicly)
+	__not_contained,
+
+	// Contained ambiguously.
+	__contained_ambig,
+
+	// Via a virtual path.
+	__contained_virtual_mask = __base_class_type_info::__virtual_mask,
+
+	// Via a public path.
+	__contained_public_mask = __base_class_type_info::__public_mask,
+
+	// Contained within us.
+	__contained_mask = 1 << __base_class_type_info::__hwm_bit,
+
+	__contained_private = __contained_mask,
+	__contained_public = __contained_mask | __contained_public_mask
+      };
+
+    struct __upcast_result;
+    struct __dyncast_result;
+
+  protected:
+    // Implementation defined member functions.
+    virtual bool
+    __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const;
+
+    virtual bool
+    __do_catch(const type_info* __thr_type, void** __thr_obj,
+	       unsigned __outer) const;
+
+  public:
+    // Helper for upcast. See if DST is us, or one of our bases.
+    // Return false if not found, true if found.
+    virtual bool
+    __do_upcast(const __class_type_info* __dst, const void* __obj,
+		__upcast_result& __restrict __result) const;
+
+    // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly
+    // within OBJ_PTR. OBJ_PTR points to a base object of our type,
+    // which is the destination type. SRC2DST indicates how SRC
+    // objects might be contained within this type.  If SRC_PTR is one
+    // of our SRC_TYPE bases, indicate the virtuality. Returns
+    // not_contained for non containment or private containment.
+    inline __sub_kind
+    __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
+		      const __class_type_info* __src_type,
+		      const void* __src_ptr) const;
+
+    // Helper for dynamic cast. ACCESS_PATH gives the access from the
+    // most derived object to this base. DST_TYPE indicates the
+    // desired type we want. OBJ_PTR points to a base of our type
+    // within the complete object. SRC_TYPE indicates the static type
+    // started from and SRC_PTR points to that base within the most
+    // derived object. Fill in RESULT with what we find. Return true
+    // if we have located an ambiguous match.
+    virtual bool
+    __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
+		 const __class_type_info* __dst_type, const void* __obj_ptr,
+		 const __class_type_info* __src_type, const void* __src_ptr,
+		 __dyncast_result& __result) const;
+
+    // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE
+    // bases are inherited by the type started from -- which is not
+    // necessarily the current type. The current type will be a base
+    // of the destination type.  OBJ_PTR points to the current base.
+    virtual __sub_kind
+    __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
+			 const __class_type_info* __src_type,
+			 const void* __src_ptr) const;
+  };
+
+  // Type information for a class with a single non-virtual base.
+  class __si_class_type_info : public __class_type_info
+  {
+  public:
+    const __class_type_info* __base_type;
+
+    explicit
+    __si_class_type_info(const char *__n, const __class_type_info *__base)
+    : __class_type_info(__n), __base_type(__base) { }
+
+    virtual
+    ~__si_class_type_info();
+
+  protected:
+    __si_class_type_info(const __si_class_type_info&);
+
+    __si_class_type_info&
+    operator=(const __si_class_type_info&);
+
+    // Implementation defined member functions.
+    virtual bool
+    __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
+		 const __class_type_info* __dst_type, const void* __obj_ptr,
+		 const __class_type_info* __src_type, const void* __src_ptr,
+		 __dyncast_result& __result) const;
+
+    virtual __sub_kind
+    __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
+			 const __class_type_info* __src_type,
+			 const void* __sub_ptr) const;
+
+    virtual bool
+    __do_upcast(const __class_type_info*__dst, const void*__obj,
+		__upcast_result& __restrict __result) const;
+  };
+
+  // Type information for a class with multiple and/or virtual bases.
+  class __vmi_class_type_info : public __class_type_info
+  {
+  public:
+    unsigned int 		__flags;  // Details about the class hierarchy.
+    unsigned int 		__base_count;  // Number of direct bases.
+
+    // The array of bases uses the trailing array struct hack so this
+    // class is not constructable with a normal constructor. It is
+    // internally generated by the compiler.
+    __base_class_type_info 	__base_info[1];  // Array of bases.
+
+    explicit
+    __vmi_class_type_info(const char* __n, int ___flags)
+    : __class_type_info(__n), __flags(___flags), __base_count(0) { }
+
+    virtual
+    ~__vmi_class_type_info();
+
+    // Implementation defined types.
+    enum __flags_masks
+      {
+	__non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base.
+	__diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance.
+	__flags_unknown_mask = 0x10
+      };
+
+  protected:
+    // Implementation defined member functions.
+    virtual bool
+    __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,
+		 const __class_type_info* __dst_type, const void* __obj_ptr,
+		 const __class_type_info* __src_type, const void* __src_ptr,
+		 __dyncast_result& __result) const;
+
+    virtual __sub_kind
+    __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,
+			 const __class_type_info* __src_type,
+			 const void* __src_ptr) const;
+
+    virtual bool
+    __do_upcast(const __class_type_info* __dst, const void* __obj,
+		__upcast_result& __restrict __result) const;
+  };
+
+  // Dynamic cast runtime.
+  // src2dst has the following possible values
+  //  >-1: src_type is a unique public non-virtual base of dst_type
+  //       dst_ptr + src2dst == src_ptr
+  //   -1: unspecified relationship
+  //   -2: src_type is not a public base of dst_type
+  //   -3: src_type is a multiple public non-virtual base of dst_type
+  extern "C" void*
+  __dynamic_cast(const void* __src_ptr, // Starting object.
+		 const __class_type_info* __src_type, // Static type of object.
+		 const __class_type_info* __dst_type, // Desired target type.
+		 ptrdiff_t __src2dst); // How src and dst are related.
+
+
+  // Returns the type_info for the currently handled exception [15.3/8], or
+  // null if there is none.
+  extern "C" std::type_info*
+  __cxa_current_exception_type() _GLIBCXX_NOTHROW __attribute__ ((__pure__));
+
+  // A magic placeholder class that can be caught by reference
+  // to recognize foreign exceptions.
+  class __foreign_exception
+  {
+    virtual ~__foreign_exception() _GLIBCXX_NOTHROW;
+    virtual void __pure_dummy() = 0; // prevent catch by value
+  };
+
+} // namespace __cxxabiv1
+
+/** @namespace abi
+ *  @brief The cross-vendor C++ Application Binary Interface. A
+ *  namespace alias to __cxxabiv1, but user programs should use the
+ *  alias 'abi'.
+ *
+ *  A brief overview of an ABI is given in the libstdc++ FAQ, question
+ *  5.8 (you may have a copy of the FAQ locally, or you can view the online
+ *  version at http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_8).
+ *
+ *  GCC subscribes to a cross-vendor ABI for C++, sometimes
+ *  called the IA64 ABI because it happens to be the native ABI for that
+ *  platform.  It is summarized at http://www.codesourcery.com/cxx-abi/
+ *  along with the current specification.
+ *
+ *  For users of GCC greater than or equal to 3.x, entry points are
+ *  available in <cxxabi.h>, which notes, <em>'It is not normally
+ *  necessary for user programs to include this header, or use the
+ *  entry points directly.  However, this header is available should
+ *  that be needed.'</em>
+*/
+namespace abi = __cxxabiv1;
+
+namespace __gnu_cxx
+{
+  /**
+   *  @brief Exception thrown by __cxa_guard_acquire.
+   *  @ingroup exceptions
+   *
+   *  6.7[stmt.dcl]/4: If control re-enters the declaration (recursively)
+   *  while the object is being initialized, the behavior is undefined.
+   *
+   *  Since we already have a library function to handle locking, we might
+   *  as well check for this situation and throw an exception.
+   *  We use the second byte of the guard variable to remember that we're
+   *  in the middle of an initialization.
+   */
+  class recursive_init_error: public std::exception
+  {
+  public:
+    recursive_init_error() throw() { }
+    virtual ~recursive_init_error() throw ();
+  };
+}
+#endif // __cplusplus
+
+#pragma GCC visibility pop
+
+#endif // __CXXABI_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/bitset b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/bitset
new file mode 100644
index 0000000..09929e7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/bitset
@@ -0,0 +1,419 @@
+// Debugging bitset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::bitset with additional safety/checking/debug instrumentation.
+  template<size_t _Nb>
+    class bitset
+    : public _GLIBCXX_STD_C::bitset<_Nb>
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+    , public __gnu_debug::_Safe_sequence_base
+#endif
+    {
+      typedef _GLIBCXX_STD_C::bitset<_Nb> _Base;
+
+    public:
+      // In C++0x we rely on normal reference type to preserve the property
+      // of bitset to be use as a literal.
+      // TODO: Find an other solution.
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      typedef typename _Base::reference reference;
+#else
+      // 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 __attribute__((__unused__)))
+	: _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;
+	}
+      };
+#endif
+
+      // 23.3.5.1 constructors:
+      _GLIBCXX_CONSTEXPR bitset() : _Base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr bitset(unsigned long long __val)
+#else
+      bitset(unsigned long __val)
+#endif
+      : _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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _CharT>
+        explicit
+        bitset(const _CharT* __str,
+	       typename std::basic_string<_CharT>::size_type __n
+	       = std::basic_string<_CharT>::npos,
+	       _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
+	: _Base(__str, __n, __zero, __one) { }
+#endif
+
+      // 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);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+	return _M_base()[__pos];
+#else
+	return reference(_M_base()[__pos], this);
+#endif
+      }
+
+      // _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;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::to_ullong;
+#endif
+
+      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
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // DR 1182.
+  /// std::hash specialization for bitset.
+  template<size_t _Nb>
+    struct hash<__debug::bitset<_Nb>>
+    : public __hash_base<size_t, __debug::bitset<_Nb>>
+    {
+      size_t
+      operator()(const __debug::bitset<_Nb>& __b) const noexcept
+      { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); }
+    };
+#endif
+
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/debug.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/debug.h
new file mode 100644
index 0000000..6ea8e2a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/debug.h
@@ -0,0 +1,129 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+#endif
+
+#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/deque b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/deque
new file mode 100644
index 0000000..fc4d8cb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/deque
@@ -0,0 +1,560 @@
+// Debugging deque implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::deque with safety/checking/debug instrumentation.
+  template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+    class deque
+    : public _GLIBCXX_STD_C::deque<_Tp, _Allocator>,
+      public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >
+    {
+      typedef  _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<deque> _Safe_base;
+
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef __gnu_debug::_Safe_iterator<_Base_iterator,deque>
+						    iterator;
+      typedef __gnu_debug::_Safe_iterator<_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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+      deque(size_type __n)
+      : _Base(__n) { }
+
+      deque(size_type __n, const _Tp& __value,
+	    const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) { }
+#else
+      explicit
+      deque(size_type __n, const _Tp& __value = _Tp(),
+	    const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) { }
+#endif
+
+      template<class _InputIterator>
+        deque(_InputIterator __first, _InputIterator __last,
+	      const _Allocator& __a = _Allocator())
+	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__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::move(__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 1204.
+	// 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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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
+
+    private:
+      void
+      _M_invalidate_after_nth(difference_type __n)
+      {
+	typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
+	this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
+      }
+      
+    public:
+      // 23.2.1.2 capacity:
+      using _Base::size;
+      using _Base::max_size;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      resize(size_type __sz)
+      {
+	bool __invalidate_all = __sz > this->size();
+	if (__sz < this->size())
+	  this->_M_invalidate_after_nth(__sz);
+
+	_Base::resize(__sz);
+
+	if (__invalidate_all)
+	  this->_M_invalidate_all();
+      }
+
+      void
+      resize(size_type __sz, const _Tp& __c)
+      {
+	bool __invalidate_all = __sz > this->size();
+	if (__sz < this->size())
+	  this->_M_invalidate_after_nth(__sz);
+
+	_Base::resize(__sz, __c);
+
+	if (__invalidate_all)
+	  this->_M_invalidate_all();
+      }
+#else
+      void
+      resize(size_type __sz, _Tp __c = _Tp())
+      {
+	bool __invalidate_all = __sz > this->size();
+	if (__sz < this->size())
+	  this->_M_invalidate_after_nth(__sz);
+
+	_Base::resize(__sz, __c);
+
+	if (__invalidate_all)
+	  this->_M_invalidate_all();
+      }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::shrink_to_fit;
+#endif
+
+      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);
+	  _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);
+	_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(), __gnu_debug::__base(__first),
+					   __gnu_debug::__base(__last));
+	  this->_M_invalidate_all();
+	}
+
+      void
+      pop_front()
+      {
+	__glibcxx_check_nonempty();
+	this->_M_invalidate_if(_Equal(_Base::begin()));
+	_Base::pop_front();
+      }
+
+      void
+      pop_back()
+      {
+	__glibcxx_check_nonempty();
+	this->_M_invalidate_if(_Equal(--_Base::end()));
+	_Base::pop_back();
+      }
+
+      iterator
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	_Base_iterator __victim = __position.base();
+	if (__victim == _Base::begin() || __victim == _Base::end()-1)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    return iterator(_Base::erase(__victim), this);
+	  }
+	else
+	  {
+	    _Base_iterator __res = _Base::erase(__victim);
+	    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.base() == __last.base())
+	  return __first;
+        else if (__first.base() == _Base::begin()
+		 || __last.base() == _Base::end())
+	  {
+	    this->_M_detach_singular();
+	    for (_Base_iterator __position = __first.base();
+		 __position != __last.base(); ++__position)
+	      {
+		this->_M_invalidate_if(_Equal(__position));
+	      }
+	    __try
+	      {
+		return iterator(_Base::erase(__first.base(), __last.base()),
+				this);
+	      }
+	    __catch(...)
+	      {
+		this->_M_revalidate_singular();
+		__throw_exception_again;
+	      }
+	  }
+	else
+	  {
+	    _Base_iterator __res = _Base::erase(__first.base(),
+						__last.base());
+	    this->_M_invalidate_all();
+	    return iterator(__res, this);
+	  }
+      }
+
+      void
+      swap(deque& __x)
+      {
+	_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); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/formatter.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/formatter.h
new file mode 100644
index 0000000..065a502
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/formatter.h
@@ -0,0 +1,415 @@
+// Debug-mode error formatting implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+#include <typeinfo>
+
+namespace __gnu_debug
+{
+  using std::type_info;
+
+  template<typename _Iterator>
+    bool __check_singular(_Iterator&);
+
+  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,
+    // forward_list
+    __msg_insert_after_end,
+    __msg_erase_after_bad,
+    __msg_valid_range2
+  };
+
+  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
+      __before_begin,  // before begin
+      __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;
+#ifdef __GXX_RTTI
+	  _M_variant._M_iterator._M_type = &typeid(__it);
+#else
+	  _M_variant._M_iterator._M_type = 0;
+#endif
+	  _M_variant._M_iterator._M_constness =
+	    std::__are_same<_Safe_iterator<_Iterator, _Sequence>,
+	                    typename _Sequence::iterator>::
+	      __value ? __mutable_iterator : __const_iterator;
+	  _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
+#ifdef __GXX_RTTI
+	  _M_variant._M_iterator._M_seq_type = &typeid(_Sequence);
+#else
+	  _M_variant._M_iterator._M_seq_type = 0;
+#endif
+
+	  if (__it._M_singular())
+	    _M_variant._M_iterator._M_state = __singular;
+	  else
+	    {
+	      if (__it._M_is_before_begin())
+		_M_variant._M_iterator._M_state = __before_begin;
+	      else if (__it._M_is_end())
+		_M_variant._M_iterator._M_state = __end;
+	      else if (__it._M_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;
+#ifdef __GXX_RTTI
+	  _M_variant._M_iterator._M_type = &typeid(__it);
+#else
+	  _M_variant._M_iterator._M_type = 0;
+#endif
+	  _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;
+#ifdef __GXX_RTTI
+	  _M_variant._M_iterator._M_type = &typeid(__it);
+#else
+	  _M_variant._M_iterator._M_type = 0;
+#endif
+	  _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;
+#ifdef __GXX_RTTI
+	  _M_variant._M_iterator._M_type = &typeid(__it);
+#else
+	  _M_variant._M_iterator._M_type = 0;
+#endif
+	  _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);
+#ifdef __GXX_RTTI
+	  _M_variant._M_sequence._M_type = &typeid(_Sequence);
+#else
+	  _M_variant._M_sequence._M_type = 0;
+#endif
+	}
+
+      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;
+#ifdef __GXX_RTTI
+	  _M_variant._M_sequence._M_type = &typeid(_Sequence);
+#else
+	  _M_variant._M_sequence._M_type = 0;
+#endif
+	}
+
+      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 < std::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 < std::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 < std::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 < std::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 throw ();
+
+    _GLIBCXX_NORETURN void
+    _M_error() const;
+
+  private:
+    _Error_formatter(const char* __file, std::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 throw ();
+
+    void
+    _M_print_word(const char* __word) const;
+
+    void
+    _M_print_string(const char* __string) const;
+
+    void
+    _M_get_max_length() const throw ();
+
+    enum { __max_parameters = 9 };
+
+    const char*         _M_file;
+    std::size_t         _M_line;
+    mutable _Parameter  _M_parameters[__max_parameters];
+    mutable std::size_t _M_num_parameters;
+    mutable const char* _M_text;
+    mutable std::size_t _M_max_length;
+    enum { _M_indent = 4 } ;
+    mutable std::size_t _M_column;
+    mutable bool        _M_first_line;
+    mutable bool        _M_wordwrap;
+
+  public:
+    static _Error_formatter
+    _M_at(const char* __file, std::size_t __line)
+    { return _Error_formatter(__file, __line); }
+  };
+} // namespace __gnu_debug
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/forward_list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/forward_list
new file mode 100644
index 0000000..70bd75a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/forward_list
@@ -0,0 +1,741 @@
+// <forward_list> -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/forward_list
+ *  This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_FORWARD_LIST
+#define _GLIBCXX_DEBUG_FORWARD_LIST 1
+
+#pragma GCC system_header
+
+#include <forward_list>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::forward_list with safety/checking/debug instrumentation.
+  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+    class forward_list
+    : public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc>,
+      public __gnu_debug::_Safe_sequence<forward_list<_Tp, _Alloc> >
+    {
+      typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base;
+      typedef __gnu_debug::_Safe_sequence<forward_list> _Safe_base;
+
+      typedef typename _Base::iterator       _Base_iterator;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef __gnu_debug::_Safe_iterator<_Base_iterator,
+					  forward_list> iterator;
+      typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,
+					  forward_list> const_iterator;
+
+      typedef typename _Base::size_type             size_type;
+      typedef typename _Base::difference_type       difference_type;
+
+      typedef _Tp                                   value_type;
+      typedef _Alloc                                allocator_type;
+      typedef typename _Base::pointer               pointer;
+      typedef typename _Base::const_pointer         const_pointer;
+
+      // 23.2.3.1 construct/copy/destroy:
+      explicit
+      forward_list(const _Alloc& __al = _Alloc())
+      : _Base(__al) { }
+
+      forward_list(const forward_list& __list, const _Alloc& __al)
+      : _Base(__list, __al)
+      { }
+
+      forward_list(forward_list&& __list, const _Alloc& __al)
+      : _Base(std::move(__list._M_base()), __al)
+      {
+	this->_M_swap(__list);
+      }
+
+      explicit
+      forward_list(size_type __n)
+      : _Base(__n)
+      { }
+
+      forward_list(size_type __n, const _Tp& __value,
+                   const _Alloc& __al = _Alloc())
+      : _Base(__n, __value, __al)
+      { }
+
+      template<typename _InputIterator>
+        forward_list(_InputIterator __first, _InputIterator __last,
+                     const _Alloc& __al = _Alloc())
+        : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__last), __al)
+        { }
+
+      forward_list(const forward_list& __list)
+      : _Base(__list)
+      { }
+
+      forward_list(forward_list&& __list)
+      : _Base(std::move(__list._M_base()))
+      {
+	this->_M_swap(__list);
+      }
+
+      forward_list(std::initializer_list<_Tp> __il,
+                   const _Alloc& __al = _Alloc())
+      : _Base(__il, __al)
+      { }
+
+      ~forward_list()
+      { }
+
+      forward_list&
+      operator=(const forward_list& __list)
+      {
+	static_cast<_Base&>(*this) = __list;
+	this->_M_invalidate_all();
+	return *this;
+      }
+
+      forward_list&
+      operator=(forward_list&& __list)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	clear();
+	swap(__list);
+	return *this;
+      }
+
+      forward_list&
+      operator=(std::initializer_list<_Tp> __il)
+      {
+	static_cast<_Base&>(*this) = __il;
+	this->_M_invalidate_all();
+        return *this;
+      }
+
+      template<typename _InputIterator>
+        void
+        assign(_InputIterator __first, _InputIterator __last)
+        {
+	  __glibcxx_check_valid_range(__first, __last);
+	  _Base::assign(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__last));
+	  this->_M_invalidate_all();
+        }
+
+      void
+      assign(size_type __n, const _Tp& __val)
+      {
+	_Base::assign(__n, __val);
+	this->_M_invalidate_all();
+      }
+
+      void
+      assign(std::initializer_list<_Tp> __il)
+      {
+	_Base::assign(__il);
+	this->_M_invalidate_all();
+      }
+
+      using _Base::get_allocator;
+
+      // iterators:
+
+      iterator
+      before_begin()
+      { return iterator(_Base::before_begin(), this); }
+
+      const_iterator
+      before_begin() const
+      { return const_iterator(_Base::before_begin(), this); }
+
+      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::cbegin(), this); }
+
+      const_iterator
+      cbefore_begin() const
+      { return const_iterator(_Base::cbefore_begin(), this); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_Base::cend(), this); }
+
+      using _Base::empty;
+      using _Base::max_size;
+
+      // element access:
+
+      reference
+      front()
+      {
+	__glibcxx_check_nonempty();
+	return _Base::front();
+      }
+
+      const_reference
+      front() const
+      {
+	__glibcxx_check_nonempty();
+	return _Base::front();
+      }
+
+      // modiﬁers:
+
+      using _Base::emplace_front;
+      using _Base::push_front;
+
+      void
+      pop_front()
+      {
+	__glibcxx_check_nonempty();
+	this->_M_invalidate_if([this](_Base_const_iterator __it)
+	  { return __it == this->_M_base().cbegin(); });
+	_Base::pop_front();
+      }
+
+      template<typename... _Args>
+	iterator
+	emplace_after(const_iterator __pos, _Args&&... __args)
+	{
+	  __glibcxx_check_insert_after(__pos);
+	  return iterator(_Base::emplace_after(__pos.base(),
+					std::forward<_Args>(__args)...),
+			  this);
+       	}
+
+      iterator
+      insert_after(const_iterator __pos, const _Tp& __val)
+      {
+	__glibcxx_check_insert_after(__pos);
+	return iterator(_Base::insert_after(__pos.base(), __val), this);
+      }
+
+      iterator
+      insert_after(const_iterator __pos, _Tp&& __val)
+      {
+	__glibcxx_check_insert_after(__pos);
+	return iterator(_Base::insert_after(__pos.base(), std::move(__val)),
+		       	this);
+      }
+
+      iterator
+      insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
+      {
+	__glibcxx_check_insert_after(__pos);
+	return iterator(_Base::insert_after(__pos.base(), __n, __val),
+		       	this);
+      }
+
+      template<typename _InputIterator>
+        iterator
+        insert_after(const_iterator __pos,
+                     _InputIterator __first, _InputIterator __last)
+        {
+	  __glibcxx_check_insert_range_after(__pos, __first, __last);
+	  return iterator(_Base::insert_after(__pos.base(),
+					      __gnu_debug::__base(__first),
+					      __gnu_debug::__base(__last)),
+			  this);
+        }
+
+      iterator
+      insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
+      {
+	__glibcxx_check_insert_after(__pos);
+	return iterator(_Base::insert_after(__pos.base(), __il), this);
+      }
+
+    private:
+      _Base_iterator
+      _M_erase_after(_Base_const_iterator __pos)
+      {
+	_Base_const_iterator __next = std::next(__pos);
+	this->_M_invalidate_if([__next](_Base_const_iterator __it)
+	  { return __it == __next; });
+	return _Base::erase_after(__pos);
+      }
+    public:
+      iterator
+      erase_after(const_iterator __pos)
+      {
+	__glibcxx_check_erase_after(__pos);
+	return iterator(_M_erase_after(__pos.base()), this);
+      }
+
+      iterator
+      erase_after(const_iterator __pos, const_iterator __last)
+      {
+	__glibcxx_check_erase_range_after(__pos, __last);
+	for (_Base_const_iterator __victim = std::next(__pos.base());
+	    __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range2)
+				  ._M_sequence(*this, "this")
+				  ._M_iterator(__pos, "pos")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if([__victim](_Base_const_iterator __it)
+	      { return __it == __victim; });
+	  }
+	return iterator(_Base::erase_after(__pos.base(), __last.base()), this);
+      }
+
+      void
+      swap(forward_list& __list)
+      {
+	_Base::swap(__list);
+	this->_M_swap(__list);
+      }
+
+      void
+      resize(size_type __sz)
+      {
+	this->_M_detach_singular();
+
+	// if __sz < size(), invalidate all iterators in [begin+__sz, end()
+	_Base_iterator __victim = _Base::begin();
+	_Base_iterator __end = _Base::end();
+	for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+	  ++__victim;
+
+	for (; __victim != __end; ++__victim)
+	  {
+	    this->_M_invalidate_if([__victim](_Base_const_iterator __it)
+	      { return __it == __victim; });
+	  }
+
+	__try
+	  {
+	    _Base::resize(__sz);
+	  }
+	__catch(...)
+	  {
+	    this->_M_revalidate_singular();
+	    __throw_exception_again;
+          }
+      }
+
+      void
+      resize(size_type __sz, const value_type& __val)
+      {
+	this->_M_detach_singular();
+
+	// if __sz < size(), invalidate all iterators in [begin+__sz, end())
+	_Base_iterator __victim = _Base::begin();
+	_Base_iterator __end = _Base::end();
+	for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+	  ++__victim;
+
+	for (; __victim != __end; ++__victim)
+	  {
+	    this->_M_invalidate_if([__victim](_Base_const_iterator __it)
+	      { return __it == __victim; });
+	  }
+
+	__try
+	  {
+	    _Base::resize(__sz, __val);
+	  }
+	__catch(...)
+	  {
+	    this->_M_revalidate_singular();
+	    __throw_exception_again;
+          }
+      }
+
+      void
+      clear()
+      {
+	_Base::clear();
+	this->_M_invalidate_all();
+      }
+
+      // 23.2.3.5 forward_list operations:
+      void
+      splice_after(const_iterator __pos, forward_list&& __list)
+      {
+        __glibcxx_check_insert_after(__pos);
+	_GLIBCXX_DEBUG_VERIFY(&__list != this,
+			      _M_message(__gnu_debug::__msg_self_splice)
+			      ._M_sequence(*this, "this"));
+	this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it)
+	  {
+	    return __it != __list._M_base().cbefore_begin()
+		   && __it != __list._M_base().end();
+	  });
+	_Base::splice_after(__pos.base(), std::move(__list._M_base()));
+      }
+
+      void
+      splice_after(const_iterator __pos, forward_list&& __list,
+		   const_iterator __i)
+      {
+	__glibcxx_check_insert_after(__pos);
+	_GLIBCXX_DEBUG_VERIFY(__i._M_before_dereferenceable(),
+			      _M_message(__gnu_debug::__msg_splice_bad)
+			      ._M_iterator(__i, "__i"));
+	_GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__list),
+			      _M_message(__gnu_debug::__msg_splice_other)
+			      ._M_iterator(__i, "__i")
+			      ._M_sequence(__list, "__list"));
+
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 250. splicing invalidates iterators
+	_Base_const_iterator __next = std::next(__i.base());
+	this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it)
+	  { return __it == __next; });
+	_Base::splice_after(__pos.base(), std::move(__list._M_base()),
+			    __i.base());
+      }
+
+      void
+      splice_after(const_iterator __pos, forward_list&& __list,
+		   const_iterator __before, const_iterator __last)
+      {
+        __glibcxx_check_insert_after(__pos);
+	__glibcxx_check_valid_range(__before, __last);
+	_GLIBCXX_DEBUG_VERIFY(__before._M_attached_to(&__list),
+			      _M_message(__gnu_debug::__msg_splice_other)
+			      ._M_sequence(__list, "list")
+			      ._M_iterator(__before, "before"));
+	_GLIBCXX_DEBUG_VERIFY(__before._M_dereferenceable()
+			      || __before._M_is_before_begin(),
+			      _M_message(__gnu_debug::__msg_valid_range2)
+			      ._M_sequence(__list, "list")
+			      ._M_iterator(__before, "before")
+			      ._M_iterator(__last, "last"));
+	_GLIBCXX_DEBUG_VERIFY(__before != __last,
+			      _M_message(__gnu_debug::__msg_valid_range2)
+			      ._M_sequence(__list, "list")
+			      ._M_iterator(__before, "before")
+			      ._M_iterator(__last, "last"));
+
+	for (_Base_const_iterator __tmp = std::next(__before.base());
+	     __tmp != __last.base(); ++__tmp)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__tmp != __list._M_base().end(),
+				  _M_message(__gnu_debug::__msg_valid_range2)
+				  ._M_sequence(__list, "list")
+				  ._M_iterator(__before, "before")
+				  ._M_iterator(__last, "last"));
+	    _GLIBCXX_DEBUG_VERIFY(&__list != this || __tmp != __pos.base(),
+                                  _M_message(__gnu_debug::__msg_splice_overlap)
+                                  ._M_iterator(__tmp, "position")
+				  ._M_iterator(__before, "before")
+				  ._M_iterator(__last, "last"));
+	    // _GLIBCXX_RESOLVE_LIB_DEFECTS
+	    // 250. splicing invalidates iterators
+	    this->_M_transfer_from_if(__list, [__tmp](_Base_const_iterator __it)
+	      { return __it == __tmp; });
+	  }
+
+	_Base::splice_after(__pos.base(), std::move(__list._M_base()),
+			    __before.base(), __last.base());
+      }
+
+      void
+      remove(const _Tp& __val)
+      {
+	_Base_iterator __x = _Base::before_begin();
+	_Base_iterator __old = __x++;
+	while (__x != _Base::end())
+	  {
+	    if (*__x == __val)
+	      __x = _M_erase_after(__old);
+	    else
+	      __old = __x++;
+	  }
+      }
+
+      template<typename _Pred>
+        void
+        remove_if(_Pred __pred)
+	{
+	  _Base_iterator __x = _Base::before_begin();
+	  _Base_iterator __old = __x++;
+	  while (__x != _Base::end())
+	    {
+	      if (__pred(*__x))
+		__x = _M_erase_after(__old);
+	      else
+		__old = __x++;
+	    }
+	}
+
+      void
+      unique()
+      {
+	_Base_iterator __first = _Base::begin();
+	_Base_iterator __last = _Base::end();
+	if (__first == __last)
+	  return;
+	_Base_iterator __next = std::next(__first);
+	while (__next != __last)
+	  {
+	    if (*__first == *__next)
+	      __next = _M_erase_after(__first);
+	    else
+	      __first = __next++;
+	  }
+      }
+
+      template<typename _BinPred>
+        void
+        unique(_BinPred __binary_pred)
+	{
+	  _Base_iterator __first = _Base::begin();
+	  _Base_iterator __last = _Base::end();
+	  if (__first == __last)
+	    return;
+	  _Base_iterator __next = std::next(__first);
+	  while (__next != __last)
+	    {
+	      if (__binary_pred(*__first, *__next))
+		__next = _M_erase_after(__first);
+	      else
+		__first = __next++;
+	    }
+	}
+
+      void
+      merge(forward_list&& __list)
+      {
+	if (this != &__list)
+	{
+	  __glibcxx_check_sorted(_Base::begin(), _Base::end());
+	  __glibcxx_check_sorted(__list._M_base().begin(),
+				 __list._M_base().end());
+	  this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it)
+	    {
+	      return __it != __list._M_base().cbefore_begin()
+		     && __it != __list._M_base().cend();
+	    });
+	  _Base::merge(std::move(__list._M_base()));
+	}
+      }
+
+      template<typename _Comp>
+        void
+        merge(forward_list&& __list, _Comp __comp)
+	{
+	  if (this != &__list)
+	  {
+	    __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp);
+	    __glibcxx_check_sorted_pred(__list._M_base().begin(),
+					__list._M_base().end(), __comp);
+	    this->_M_transfer_from_if(__list,
+				      [&__list](_Base_const_iterator __it)
+	      {
+	        return __it != __list._M_base().cbefore_begin()
+		       && __it != __list._M_base().cend();
+	      });
+	    _Base::merge(std::move(__list._M_base()), __comp);
+	  }
+	}
+
+      using _Base::sort;
+      using _Base::reverse;
+
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+    private:
+      void
+      _M_invalidate_all()
+      {
+	this->_M_invalidate_if([this](_Base_const_iterator __it)
+	  {
+	    return __it != this->_M_base().cbefore_begin()
+		   && __it != this->_M_base().cend();
+	  });
+      }
+      typedef __gnu_debug::_Safe_iterator_base _Safe_iterator_base;
+      static void
+      _M_swap_aux(forward_list& __lhs,
+		  _Safe_iterator_base*& __lhs_iterators,
+		  forward_list& __rhs,
+		  _Safe_iterator_base*& __rhs_iterators);
+      void _M_swap(forward_list& __list);
+    };
+
+   template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    _M_swap_aux(forward_list<_Tp, _Alloc>& __lhs,
+		__gnu_debug::_Safe_iterator_base*& __lhs_iterators,
+		forward_list<_Tp, _Alloc>& __rhs,
+		__gnu_debug::_Safe_iterator_base*& __rhs_iterators)
+    {
+      using __gnu_debug::_Safe_iterator_base;
+      _Safe_iterator_base* __bbegin_its = 0;
+      _Safe_iterator_base* __last_bbegin = 0;
+      for (_Safe_iterator_base* __iter = __lhs_iterators; __iter;)
+	{
+	  // Even iterator are casted to const_iterator, not a problem.
+	  const_iterator* __victim = static_cast<const_iterator*>(__iter);
+	  __iter = __iter->_M_next;
+	  if (__victim->base() == __rhs._M_base().cbefore_begin())
+	    {
+	      __victim->_M_unlink();
+	      if (__lhs_iterators == __victim)
+		__lhs_iterators = __victim->_M_next;
+	      if (__bbegin_its)
+		{
+		  __victim->_M_next = __bbegin_its;
+		  __bbegin_its->_M_prior = __victim;
+		}
+	      else
+		__last_bbegin = __victim;
+	      __bbegin_its = __victim;
+	    }
+	  else
+	    __victim->_M_sequence = &__lhs;
+	}
+
+      if (__bbegin_its)
+	{
+	  if (__rhs_iterators)
+	    {
+	      __rhs_iterators->_M_prior = __last_bbegin;
+	      __last_bbegin->_M_next = __rhs_iterators;
+	    }
+	  __rhs_iterators = __bbegin_its;
+	}
+    }
+
+  /* Special forward_list _M_swap version that do not swap the
+   * before-begin ownership.*/
+  template<typename _Tp, typename _Alloc>
+    void
+    forward_list<_Tp, _Alloc>::
+    _M_swap(forward_list<_Tp, _Alloc>& __list)
+    {
+      __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
+      std::swap(this->_M_iterators, __list._M_iterators);
+      std::swap(this->_M_const_iterators, __list._M_const_iterators);
+      // Useless, always 1 on forward_list
+      //std::swap(this->_M_version, __list._M_version);
+      _Safe_iterator_base* __this_its = this->_M_iterators;
+      _M_swap_aux(__list, __list._M_iterators, *this, this->_M_iterators);
+      _Safe_iterator_base* __this_const_its = this->_M_const_iterators;
+      _M_swap_aux(__list, __list._M_const_iterators, *this, this->_M_const_iterators);
+      _M_swap_aux(*this, __this_its, __list, __list._M_iterators);
+      _M_swap_aux(*this, __this_const_its, __list, __list._M_const_iterators);
+    }
+
+  template<typename _Tp, typename _Alloc>
+    bool
+    operator==(const forward_list<_Tp, _Alloc>& __lx,
+               const forward_list<_Tp, _Alloc>& __ly)
+    { return __lx._M_base() == __ly._M_base(); }
+
+  template<typename _Tp, typename _Alloc>
+    inline bool
+    operator<(const forward_list<_Tp, _Alloc>& __lx,
+              const forward_list<_Tp, _Alloc>& __ly)
+    { return __lx._M_base() < __ly._M_base(); }
+
+  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); }
+
+} // namespace __debug
+} // namespace std
+
+namespace __gnu_debug
+{
+  template<class _Tp, class _Alloc>
+    struct _BeforeBeginHelper<std::__debug::forward_list<_Tp, _Alloc> >
+    {
+      typedef std::__debug::forward_list<_Tp, _Alloc> _Sequence;
+      typedef typename _Sequence::const_iterator _It;
+      typedef typename _It::iterator_type _BaseIt;
+
+      static bool
+      _M_Is(_BaseIt __it, const _Sequence* __seq)
+      { return __it == __seq->_M_base().cbefore_begin(); }
+    };
+}
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/functions.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/functions.h
new file mode 100644
index 0000000..75ed9ef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/functions.h
@@ -0,0 +1,383 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/stl_iterator_base_types.h> // for iterator_traits, categories
+#include <bits/cpp_type_traits.h>         // for __is_integer
+#include <debug/formatter.h>
+
+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_check_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_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_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_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_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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/list
new file mode 100644
index 0000000..a7a2c54
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/list
@@ -0,0 +1,744 @@
+// Debugging list implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::list with safety/checking/debug instrumentation.
+  template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+    class list
+    : public _GLIBCXX_STD_C::list<_Tp, _Allocator>,
+      public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> >
+    {
+      typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<list>  _Safe_base;
+
+      typedef typename _Base::iterator       _Base_iterator;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+      typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef __gnu_debug::_Safe_iterator<_Base_iterator, list>
+						    iterator;
+      typedef __gnu_debug::_Safe_iterator<_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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+      list(size_type __n)
+      : _Base(__n) { }
+
+      list(size_type __n, const _Tp& __value,
+	   const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) { }
+#else
+      explicit
+      list(size_type __n, const _Tp& __value = _Tp(),
+	   const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) { }
+#endif
+
+      template<class _InputIterator>
+      list(_InputIterator __first, _InputIterator __last,
+	   const _Allocator& __a = _Allocator())
+      : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								   __last)),
+              __gnu_debug::__base(__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::move(__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 1204.
+	// 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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      resize(size_type __sz)
+      {
+	this->_M_detach_singular();
+
+	// if __sz < size(), invalidate all iterators in [begin+__sz, end())
+	_Base_iterator __victim = _Base::begin();
+	_Base_iterator __end = _Base::end();
+	for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+	  ++__victim;
+
+	for (; __victim != __end; ++__victim)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+
+	__try
+	  {
+	    _Base::resize(__sz);
+	  }
+	__catch(...)
+	  {
+	    this->_M_revalidate_singular();
+	    __throw_exception_again;
+	  }
+      }
+
+      void
+      resize(size_type __sz, const _Tp& __c)
+      {
+	this->_M_detach_singular();
+
+	// if __sz < size(), invalidate all iterators in [begin+__sz, end())
+	_Base_iterator __victim = _Base::begin();
+	_Base_iterator __end = _Base::end();
+	for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+	  ++__victim;
+
+	for (; __victim != __end; ++__victim)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+
+	__try
+	  {
+	    _Base::resize(__sz, __c);
+	  }
+	__catch(...)
+	  {
+	    this->_M_revalidate_singular();
+	    __throw_exception_again;
+	  }
+      }
+#else
+      void
+      resize(size_type __sz, _Tp __c = _Tp())
+      {
+	this->_M_detach_singular();
+
+	// if __sz < size(), invalidate all iterators in [begin+__sz, end())
+	_Base_iterator __victim = _Base::begin();
+	_Base_iterator __end = _Base::end();
+	for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+	  ++__victim;
+
+	for (; __victim != __end; ++__victim)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+
+	__try
+	  {
+	    _Base::resize(__sz, __c);
+	  }
+	__catch(...)
+	  {
+	    this->_M_revalidate_singular();
+	    __throw_exception_again;
+	  }
+      }
+#endif
+
+      // 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();
+	this->_M_invalidate_if(_Equal(_Base::begin()));
+	_Base::pop_front();
+      }
+
+      using _Base::push_back;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::emplace_back;
+#endif
+
+      void
+      pop_back()
+      {
+	__glibcxx_check_nonempty();
+	this->_M_invalidate_if(_Equal(--_Base::end()));
+	_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(), __gnu_debug::__base(__first),
+					   __gnu_debug::__base(__last));
+	}
+
+    private:
+      _Base_iterator
+      _M_erase(_Base_iterator __position)
+      {
+	this->_M_invalidate_if(_Equal(__position));
+	return _Base::erase(__position);
+      }
+    public:
+      iterator
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	return iterator(_M_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 (_Base_iterator __victim = __position.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+			          _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__position, "position")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	return iterator(_Base::erase(__position.base(), __last.base()), this);
+      }
+
+      void
+      swap(list& __x)
+      {
+	_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->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()));
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x)
+      { splice(__position, std::move(__x)); }
+#endif
+
+      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_from_if(__x, _Equal(__i.base()));
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+		      __i.base());
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __i)
+      { splice(__position, std::move(__x), __i); }
+#endif
+
+      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 (_Base_iterator __tmp = __first.base();
+	     __tmp != __last.base(); ++__tmp)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "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"));
+	    // _GLIBCXX_RESOLVE_LIB_DEFECTS
+	    // 250. splicing invalidates iterators
+	    this->_M_transfer_from_if(__x, _Equal(__tmp));
+	  }
+
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+		      __first.base(), __last.base());
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __first, iterator __last)
+      { splice(__position, std::move(__x), __first, __last); }
+#endif
+
+      void
+      remove(const _Tp& __value)
+      {
+	for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); )
+	  {
+	    if (*__x == __value)
+	      __x = _M_erase(__x);
+	    else
+	      ++__x;
+	  }
+      }
+
+      template<class _Predicate>
+        void
+        remove_if(_Predicate __pred)
+        {
+	  for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); )
+	    {
+	      if (__pred(*__x))
+		__x = _M_erase(__x);
+	      else
+		++__x;
+	    }
+	}
+
+      void
+      unique()
+      {
+	_Base_iterator __first = _Base::begin();
+	_Base_iterator __last = _Base::end();
+	if (__first == __last)
+	  return;
+	_Base_iterator __next = __first; ++__next;
+	while (__next != __last)
+	  {
+	    if (*__first == *__next)
+	      __next = _M_erase(__next);
+	    else
+	      __first = __next++;
+	  }
+      }
+
+      template<class _BinaryPredicate>
+        void
+        unique(_BinaryPredicate __binary_pred)
+        {
+	  _Base_iterator __first = _Base::begin();
+	  _Base_iterator __last = _Base::end();
+	  if (__first == __last)
+	    return;
+	  _Base_iterator __next = __first; ++__next;
+	  while (__next != __last)
+	    {
+	      if (__binary_pred(*__first, *__next))
+		__next = _M_erase(__next);
+	      else
+		__first = __next++;
+	    }
+	}
+
+      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());
+	    this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
+	    _Base::merge(_GLIBCXX_MOVE(__x._M_base()));
+	  }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      merge(list& __x)
+      { merge(std::move(__x)); }
+#endif
+
+      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);
+	      this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
+	      _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp);
+	    }
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Compare>
+        void
+        merge(list& __x, _Compare __comp)
+        { merge(std::move(__x), __comp); }
+#endif
+
+      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()
+      {
+	this->_M_invalidate_if(_Not_equal(_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); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/macros.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/macros.h
new file mode 100644
index 0000000..c90bec5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/macros.h
@@ -0,0 +1,312 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+ * @a 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, 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 into *this after the iterator _Position.
+ *  Insertion into a container after a specific position requires that
+ *  the iterator be nonsingular, either dereferenceable or before-begin,
+ *  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_after(_Position)				\
+__glibcxx_check_insert(_Position);					\
+_GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(),				\
+		      _M_message(__gnu_debug::__msg_insert_after_end)	\
+		      ._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.
+ *
+ *  @todo 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_check_insert(_Position)
+
+/** Verify that we can insert the values in the iterator range
+ *  [_First, _Last) into *this after the iterator _Position.  Insertion
+ *  into a container after 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.
+ *
+ *  @todo 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_after(_Position,_First,_Last)	\
+__glibcxx_check_valid_range(_First,_Last);				\
+__glibcxx_check_insert_after(_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 element after the iterator
+ * _Position. We can erase the element if the _Position iterator is
+ * before a dereferenceable one and references this sequence.
+*/
+#define __glibcxx_check_erase_after(_Position)				\
+_GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(),		\
+		      _M_message(__gnu_debug::__msg_erase_after_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 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_after(_First,_Last)			\
+_GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last),			\
+		      _M_message(__gnu_debug::__msg_erase_different)	\
+		      ._M_sequence(*this, "this")			\
+		      ._M_iterator(_First, #_First)			\
+		      ._M_iterator(_Last, #_Last));			\
+_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this),			\
+		      _M_message(__gnu_debug::__msg_erase_different)	\
+		      ._M_sequence(*this, "this")			\
+		      ._M_iterator(_First, #_First));			\
+_GLIBCXX_DEBUG_VERIFY(_First != _Last,					\
+		      _M_message(__gnu_debug::__msg_valid_range2)	\
+		      ._M_sequence(*this, "this")			\
+		      ._M_iterator(_First, #_First)			\
+		      ._M_iterator(_Last, #_Last));			\
+_GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(),			\
+		      _M_message(__gnu_debug::__msg_valid_range2)	\
+		      ._M_sequence(*this, "this")			\
+		      ._M_iterator(_First, #_First)			\
+		      ._M_iterator(_Last, #_Last));			\
+_GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(),			\
+		      _M_message(__gnu_debug::__msg_valid_range2)	\
+		      ._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_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_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/8/sources/cxx-stl/gnu-libstdc++/include/debug/map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/map
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map.h
new file mode 100644
index 0000000..177797d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map.h
@@ -0,0 +1,475 @@
+// Debugging map implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::map with safety/checking/debug instrumentation.
+  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+    class map
+    : public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>,
+      public __gnu_debug::_Safe_sequence<map<_Key, _Tp, _Compare, _Allocator> >
+    {
+      typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<map> _Safe_base;
+
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+    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;
+
+      // 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::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__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::move(__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 1204.
+	// 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__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        std::pair<iterator, bool>
+        insert(_Pair&& __x)
+        {
+	  typedef typename _Base::iterator _Base_iterator;
+	  std::pair<_Base_iterator, bool> __res
+	    = _Base::insert(std::forward<_Pair>(__x));
+	  return std::pair<iterator, bool>(iterator(__res.first, this),
+					   __res.second);
+	}
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(std::initializer_list<value_type> __list)
+      { _Base::insert(__list); }
+#endif
+
+      iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      insert(const_iterator __position, const value_type& __x)
+#else
+      insert(iterator __position, const value_type& __x)
+#endif
+      {
+	__glibcxx_check_insert(__position);
+	return iterator(_Base::insert(__position.base(), __x), this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __position, _Pair&& __x)
+        {
+	  __glibcxx_check_insert(__position);
+	  return iterator(_Base::insert(__position.base(),
+					std::forward<_Pair>(__x)), this);
+	}
+#endif
+
+      template<typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        {
+	  __glibcxx_check_valid_range(__first, __last);
+	  _Base::insert(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__last));
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	return iterator(_Base::erase(__position.base()), this);
+      }
+
+      iterator
+      erase(iterator __position)
+      { return erase(const_iterator(__position)); }
+#else
+      void
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	_Base::erase(__position.base());
+      }
+#endif
+
+      size_type
+      erase(const key_type& __x)
+      {
+	_Base_iterator __victim = _Base::find(__x);
+	if (__victim == _Base::end())
+	  return 0;
+	else
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim);
+	    return 1;
+	  }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	return iterator(_Base::erase(__first.base(), __last.base()), this);
+      }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	_Base::erase(__first.base(), __last.base());
+      }
+#endif
+
+      void
+      swap(map& __x)
+      {
+	_Base::swap(__x);
+	this->_M_swap(__x);
+      }
+
+      void
+      clear()
+      {
+	this->_M_invalidate_all();
+	_Base::clear();
+      }
+
+      // 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); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multimap.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multimap.h
new file mode 100644
index 0000000..d2e1976
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multimap.h
@@ -0,0 +1,455 @@
+// Debugging multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::multimap with safety/checking/debug instrumentation.
+  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+    class multimap
+    : public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>,
+      public __gnu_debug::_Safe_sequence<multimap<_Key, _Tp,
+						  _Compare, _Allocator> >
+    {
+      typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
+
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+    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<_Base_iterator, multimap>
+                                                     iterator;
+      typedef __gnu_debug::_Safe_iterator<_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;
+
+      // 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::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__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::move(__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 1204.
+	// 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__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(_Pair&& __x)
+        { return iterator(_Base::insert(std::forward<_Pair>(__x)), this); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(std::initializer_list<value_type> __list)
+      { _Base::insert(__list); }
+#endif
+
+      iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      insert(const_iterator __position, const value_type& __x)
+#else
+      insert(iterator __position, const value_type& __x)
+#endif
+      {
+	__glibcxx_check_insert(__position);
+	return iterator(_Base::insert(__position.base(), __x), this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __position, _Pair&& __x)
+        {
+	  __glibcxx_check_insert(__position);
+	  return iterator(_Base::insert(__position.base(),
+					std::forward<_Pair>(__x)), this);
+	}
+#endif
+
+      template<typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        {
+	  __glibcxx_check_valid_range(__first, __last);
+	  _Base::insert(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__last));
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	return iterator(_Base::erase(__position.base()), this);
+      }
+
+      iterator
+      erase(iterator __position)
+      { return erase(const_iterator(__position)); }
+#else
+      void
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	_Base::erase(__position.base());
+      }
+#endif
+
+      size_type
+      erase(const key_type& __x)
+      {
+	std::pair<_Base_iterator, _Base_iterator> __victims =
+	  _Base::equal_range(__x);
+	size_type __count = 0;
+	_Base_iterator __victim = __victims.first;
+	while (__victim !=  __victims.second)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim++);
+	    ++__count;
+	  }
+	return __count;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	return iterator(_Base::erase(__first.base(), __last.base()), this);
+      }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	_Base::erase(__first.base(), __last.base());
+      }
+#endif
+
+      void
+      swap(multimap& __x)
+      {
+	_Base::swap(__x);
+	this->_M_swap(__x);
+      }
+
+      void
+      clear()
+      {
+	this->_M_invalidate_all();
+	_Base::clear();
+      }
+
+      // 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)
+      {
+	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
+      {
+	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 __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+	this->_M_invalidate_if(_Not_equal(_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); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multiset.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multiset.h
new file mode 100644
index 0000000..6808fb8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multiset.h
@@ -0,0 +1,441 @@
+// Debugging multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::multiset with safety/checking/debug instrumentation.
+  template<typename _Key, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<_Key> >
+    class multiset
+    : public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>,
+      public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >
+    {
+      typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base;
+
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+    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<_Base_iterator, multiset>
+      iterator;
+      typedef __gnu_debug::_Safe_iterator<_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::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__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::move(__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 1204.
+	// 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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(value_type&& __x)
+      { return iterator(_Base::insert(std::move(__x)), this); }
+#endif
+
+      iterator
+      insert(const_iterator __position, const value_type& __x)
+      {
+	__glibcxx_check_insert(__position);
+	return iterator(_Base::insert(__position.base(), __x), this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(const_iterator __position, value_type&& __x)
+      {
+	__glibcxx_check_insert(__position);
+	return iterator(_Base::insert(__position.base(), std::move(__x)),
+			this);
+      }
+#endif
+
+      template<typename _InputIterator>
+	void
+	insert(_InputIterator __first, _InputIterator __last)
+	{
+	  __glibcxx_check_valid_range(__first, __last);
+	  _Base::insert(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__last));
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(initializer_list<value_type> __l)
+      { _Base::insert(__l); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	return iterator(_Base::erase(__position.base()), this);
+      }
+#else
+      void
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	_Base::erase(__position.base());
+      }
+#endif
+
+      size_type
+      erase(const key_type& __x)
+      {
+	std::pair<_Base_iterator, _Base_iterator> __victims =
+	  _Base::equal_range(__x);
+	size_type __count = 0;
+	_Base_iterator __victim = __victims.first;
+	while (__victim != __victims.second)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim++);
+	    ++__count;
+	  }
+	return __count;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	return iterator(_Base::erase(__first.base(), __last.base()), this);
+      }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	_Base::erase(__first.base(), __last.base());
+      }
+#endif
+
+      void
+      swap(multiset& __x)
+      {
+	_Base::swap(__x);
+	this->_M_swap(__x);
+      }
+
+      void
+      clear()
+      {
+	this->_M_invalidate_all();
+	_Base::clear();
+      }
+
+      // 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)
+      {
+	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
+      {
+	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 __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+	this->_M_invalidate_if(_Not_equal(_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); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_base.h
new file mode 100644
index 0000000..1348004
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_base.h
@@ -0,0 +1,255 @@
+// Safe sequence/iterator base implementation  -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 @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() throw ();
+
+  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) throw ();
+
+    /** Detach the iterator for whatever sequence it is attached to,
+     *	if any.
+    */
+    void _M_detach();
+
+    /** Likewise, but not thread-safe. */
+    void _M_detach_single() throw ();
+
+    /** 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? */
+    _GLIBCXX_PURE bool _M_singular() const throw ();
+
+    /** Can we compare this iterator to the given iterator @p __x?
+	Returns true if both iterators are nonsingular and reference
+	the same sequence. */
+    _GLIBCXX_PURE bool _M_can_compare(const _Safe_iterator_base& __x) const throw ();
+
+    /** Invalidate the iterator, making it singular. */
+    void
+    _M_invalidate()
+    { _M_version = 0; }
+
+    /** Reset all member variables */
+    void
+    _M_reset() throw ();
+
+    /** Unlink itself */
+    void
+    _M_unlink() throw ()
+    {
+      if (_M_prior)
+	_M_prior->_M_next = _M_next;
+      if (_M_next)
+	_M_next->_M_prior = _M_prior;
+    }
+  };
+
+  /**
+   * @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 @a 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() throw ();
+
+  public:
+    /** Invalidates all iterators. */
+    void
+    _M_invalidate_all() const
+    { if (++_M_version == 0) _M_version = 1; }
+
+    /** Attach an iterator to this sequence. */
+    void
+    _M_attach(_Safe_iterator_base* __it, bool __constant);
+
+    /** Likewise but not thread safe. */
+    void
+    _M_attach_single(_Safe_iterator_base* __it, bool __constant) throw ();
+
+    /** Detach an iterator from this sequence */
+    void
+    _M_detach(_Safe_iterator_base* __it);
+
+    /** Likewise but not thread safe. */
+    void
+    _M_detach_single(_Safe_iterator_base* __it) throw ();
+  };
+} // namespace __gnu_debug
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.h
new file mode 100644
index 0000000..127c3ba
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.h
@@ -0,0 +1,689 @@
+// Safe iterator implementation  -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/safe_base.h>
+#include <bits/stl_pair.h>
+#include <bits/stl_iterator_base_types.h> // for _Iter_base
+#include <ext/type_traits.h>
+
+namespace __gnu_debug
+{
+  /** Helper struct to deal with sequence offering a before_begin
+   *  iterator.
+   **/
+  template <typename _Sequence>
+    struct _BeforeBeginHelper
+    {
+      typedef typename _Sequence::const_iterator _It;
+      typedef typename _It::iterator_type _BaseIt;
+
+      static bool
+      _M_Is(_BaseIt __it, const _Sequence* __seq)
+      { return false; }
+    };
+
+  /** 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 std::__are_same<const_iterator, _Safe_iterator>::__value;
+      }
+
+      typedef std::iterator_traits<_Iterator> _Traits;
+
+    public:
+      typedef _Iterator                           iterator_type;
+      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.
+       */
+      _Safe_iterator(const _Safe_iterator& __x)
+      : _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// DR 408. Is vector<reverse_iterator<char*> > forbidden?
+	_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+			      || __x._M_current == _Iterator(),
+			      _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.
+      */
+      template<typename _MutableIterator>
+        _Safe_iterator(
+          const _Safe_iterator<_MutableIterator,
+          typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator,
+                      typename _Sequence::iterator::iterator_type>::__value),
+                   _Sequence>::__type>& __x)
+	: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
+        {
+	  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+	  // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+	  _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+				|| __x.base() == _Iterator(),
+				_M_message(__msg_init_const_singular)
+				._M_iterator(*this, "this")
+				._M_iterator(__x, "other"));
+	}
+
+      /**
+       * @brief Copy assignment.
+       */
+      _Safe_iterator&
+      operator=(const _Safe_iterator& __x)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// DR 408. Is vector<reverse_iterator<char*> > forbidden?
+	_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+			      || __x._M_current == _Iterator(),
+			      _M_message(__msg_copy_singular)
+			      ._M_iterator(*this, "this")
+			      ._M_iterator(__x, "other"));
+	_M_current = __x._M_current;
+	this->_M_attach(__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(_Safe_sequence_base* __seq)
+      {
+	_Safe_iterator_base::_M_attach(__seq, _M_constant());
+      }
+
+      /** Likewise, but not thread-safe. */
+      void
+      _M_attach_single(_Safe_sequence_base* __seq)
+      {
+	_Safe_iterator_base::_M_attach_single(__seq, _M_constant());
+      }
+
+      /// Is the iterator dereferenceable?
+      bool
+      _M_dereferenceable() const
+      { return !this->_M_singular() && !_M_is_end() && !_M_is_before_begin(); }
+
+      /// Is the iterator before a dereferenceable one?
+      bool
+      _M_before_dereferenceable() const
+      {
+	_Self __it = *this;
+	return __it._M_incrementable() && (++__it)._M_dereferenceable();
+      }
+
+      /// Is the iterator incrementable?
+      bool
+      _M_incrementable() const
+      { return !this->_M_singular() && !_M_is_end(); }
+
+      // 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 - __lhs, __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 == __rhs? 0 : 1, __dp_equality); }
+
+      /// Is this iterator equal to the sequence's begin() iterator?
+      bool _M_is_begin() const
+      { return base() == _M_get_sequence()->_M_base().begin(); }
+
+      /// Is this iterator equal to the sequence's end() iterator?
+      bool _M_is_end() const
+      { return base() == _M_get_sequence()->_M_base().end(); }
+
+      /// Is this iterator equal to the sequence's before_begin() iterator if
+      /// any?
+      bool _M_is_before_begin() const
+      { return _BeforeBeginHelper<_Sequence>::_M_Is(base(), _M_get_sequence()); }
+    };
+
+  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; }
+
+  // Helper struct to detect random access safe iterators.
+  template<typename _Iterator>
+    struct __is_safe_random_iterator
+    {
+      enum { __value = 0 };
+      typedef std::__false_type __type;
+    };
+
+  template<typename _Iterator, typename _Sequence>
+    struct __is_safe_random_iterator<_Safe_iterator<_Iterator, _Sequence> >
+    : std::__are_same<std::random_access_iterator_tag,
+                      typename std::iterator_traits<_Iterator>::
+		      iterator_category>
+    { };
+
+  template<typename _Iterator>
+    struct _Siter_base
+    : std::_Iter_base<_Iterator, __is_safe_random_iterator<_Iterator>::__value>
+    { };
+
+  /** Helper function to extract base iterator of random access safe iterator
+      in order to reduce performance impact of debug mode.  Limited to random
+      access iterator because it is the only category for which it is possible
+      to check for correct iterators order in the __valid_range function
+      thanks to the < operator.
+  */
+  template<typename _Iterator>
+    inline typename _Siter_base<_Iterator>::iterator_type
+    __base(_Iterator __it)
+    { return _Siter_base<_Iterator>::_S_base(__it); }
+} // namespace __gnu_debug
+
+#include <debug/safe_iterator.tcc>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.tcc
new file mode 100644
index 0000000..942640c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.tcc
@@ -0,0 +1,106 @@
+// Debugging iterator implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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_debug_iterator;
+      typedef typename const_debug_iterator::iterator_type const_iterator;
+
+      if (this->_M_singular())
+	return false;
+      if (__n == 0)
+	return true;
+      if (__n < 0)
+	{
+	  const_iterator __begin = _M_get_sequence()->_M_base().begin();
+	  std::pair<difference_type, _Distance_precision> __dist =
+	    this->_M_get_distance(__begin, base());
+	  bool __ok =  ((__dist.second == __dp_exact && __dist.first >= -__n)
+			|| (__dist.second != __dp_exact && __dist.first > 0));
+	  return __ok;
+	}
+      else
+	{
+	  const_iterator __end = _M_get_sequence()->_M_base().end();
+	  std::pair<difference_type, _Distance_precision> __dist =
+	    this->_M_get_distance(base(), __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(base(), __rhs.base());
+	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. */
+	/* Optim for classic [begin, it) or [it, end) ranges, limit checks
+	 * when code is valid. */
+	if (_M_is_begin() || __rhs._M_is_end())
+	  return true;
+	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;
+      }
+} // namespace __gnu_debug
+
+#endif
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.h
new file mode 100644
index 0000000..cc1f4c1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.h
@@ -0,0 +1,135 @@
+// Safe sequence implementation  -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 simple function object that returns true if the passed-in
+   *  value is equal to the stored value. */
+  template <typename _Type>
+    class _Equal_to
+    {
+      _Type __value;
+
+    public:
+      explicit _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 @a safe sequence type that
+   * tracks iterators that reference it.
+   *
+   * The class template %_Safe_sequence simplifies the construction of
+   * @a 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. @c pred will be invoked with the normal iterators nested
+	  in the safe ones. */
+      template<typename _Predicate>
+        void
+        _M_invalidate_if(_Predicate __pred);
+
+      /** Transfers all iterators @c x that reference @c from sequence,
+	  are not singular, and for which @c pred(x) returns @c
+	  true. @c pred will be invoked with the normal iterators nested
+	  in the safe ones. */
+      template<typename _Predicate>
+        void
+        _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred);
+    };
+} // namespace __gnu_debug
+
+#include <debug/safe_sequence.tcc>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.tcc
new file mode 100644
index 0000000..bf0295c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.tcc
@@ -0,0 +1,150 @@
+// Safe sequence implementation  -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.tcc
+ *  This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC
+#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC 1
+
+namespace __gnu_debug
+{
+  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() && __pred(__victim->base()))
+	      {
+		__victim->_M_invalidate();
+	      }
+	  }
+
+        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() && __pred(__victim->base()))
+	      {
+		__victim->_M_invalidate();
+	      }
+	  }
+      }
+
+  template<typename _Sequence>
+    template<typename _Predicate>
+      void
+      _Safe_sequence<_Sequence>::
+      _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred)
+      {
+        typedef typename _Sequence::iterator iterator;
+        typedef typename _Sequence::const_iterator const_iterator;
+
+	_Safe_iterator_base* __transfered_iterators = 0;
+	_Safe_iterator_base* __transfered_const_iterators = 0;
+	_Safe_iterator_base* __last_iterator = 0;
+	_Safe_iterator_base* __last_const_iterator = 0;
+	{
+	  // We lock __from first and detach iterator(s) to transfer
+	  __gnu_cxx::__scoped_lock sentry(__from._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() && __pred(__victim->base()))
+		{
+		  __victim->_M_detach_single();
+		  if (__transfered_iterators)
+		    {
+		      __victim->_M_next = __transfered_iterators;
+		      __transfered_iterators->_M_prior = __victim;
+		    }
+		  else
+		    __last_iterator = __victim;
+		  __victim->_M_sequence = this;
+		  __victim->_M_version = this->_M_version;
+		  __transfered_iterators = __victim;
+		}
+	    }
+
+	  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() && __pred(__victim->base()))
+		{
+		  __victim->_M_detach_single();
+		  if (__transfered_const_iterators)
+		    {
+		      __victim->_M_next = __transfered_const_iterators;
+		      __transfered_const_iterators->_M_prior = __victim;
+		    }
+		  else
+		    __last_const_iterator = __victim;
+		  __victim->_M_sequence = this;
+		  __victim->_M_version = this->_M_version;
+		  __transfered_const_iterators = __victim;
+		}
+	    }
+	}
+
+	// Now we can lock *this and add the transfered iterators if any
+	if (__last_iterator || __last_const_iterator)
+	  {
+	    __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
+	    if (__last_iterator)
+	      {
+		if (this->_M_iterators)
+		  {
+		    this->_M_iterators->_M_prior = __last_iterator;
+		    __last_iterator->_M_next = this->_M_iterators;
+		  }
+		this->_M_iterators = __transfered_iterators;
+	      }
+	    if (__last_const_iterator)
+	      {
+		if (this->_M_const_iterators)
+		  {
+		    this->_M_const_iterators->_M_prior = __last_const_iterator;
+		    __last_const_iterator->_M_next = this->_M_const_iterators;
+		  }
+		this->_M_const_iterators = __transfered_const_iterators;
+	      }
+	  }
+      }
+} // namespace __gnu_debug
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/debug/set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/debug/set
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set.h
new file mode 100644
index 0000000..7ca4c77
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set.h
@@ -0,0 +1,449 @@
+// Debugging set implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default) 
+{
+namespace __debug
+{
+  /// Class std::set with safety/checking/debug instrumentation.
+  template<typename _Key, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<_Key> >
+    class set
+    : public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator>,
+      public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> >
+    {
+      typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
+
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+    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<_Base_iterator, set>
+                                                    iterator;
+      typedef __gnu_debug::_Safe_iterator<_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::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__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::move(__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 1204.
+	// 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)
+      {
+	std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
+	return std::pair<iterator, bool>(iterator(__res.first, this),
+					 __res.second);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      std::pair<iterator, bool>
+      insert(value_type&& __x)
+      {
+	typedef typename _Base::iterator _Base_iterator;
+	std::pair<_Base_iterator, bool> __res
+	  = _Base::insert(std::move(__x));
+	return std::pair<iterator, bool>(iterator(__res.first, this),
+					 __res.second);
+      }
+#endif
+
+      iterator
+      insert(const_iterator __position, const value_type& __x)
+      {
+	__glibcxx_check_insert(__position);
+	return iterator(_Base::insert(__position.base(), __x), this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(const_iterator __position, value_type&& __x)
+      {
+	__glibcxx_check_insert(__position);
+	return iterator(_Base::insert(__position.base(), std::move(__x)),
+			this);
+      }
+#endif
+
+      template <typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        {
+	  __glibcxx_check_valid_range(__first, __last);
+	  _Base::insert(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__last));
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(initializer_list<value_type> __l)
+      { _Base::insert(__l); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	return iterator(_Base::erase(__position.base()), this);
+      }
+#else
+      void
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	this->_M_invalidate_if(_Equal(__position.base()));
+	_Base::erase(__position.base());
+      }
+#endif
+
+      size_type
+      erase(const key_type& __x)
+      {
+	_Base_iterator __victim = _Base::find(__x);
+	if (__victim == _Base::end())
+          return 0;
+	else
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim);
+	    return 1;
+	  }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	return iterator(_Base::erase(__first.base(), __last.base()), this);
+      }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_iterator __victim = __first.base();
+	     __victim != __last.base(); ++__victim)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__victim));
+	  }
+	_Base::erase(__first.base(), __last.base());
+      }
+#endif
+
+      void
+      swap(set& __x)
+      {
+	_Base::swap(__x);
+	this->_M_swap(__x);
+      }
+
+      void
+      clear()
+      {
+	this->_M_invalidate_all();
+	_Base::clear();
+      }
+
+      // 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)
+      {
+	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
+      {
+	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 __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); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/string b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/string
new file mode 100644
index 0000000..fe073f2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/string
@@ -0,0 +1,1113 @@
+// Debugging string implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+{
+  /// Class std::basic_string with safety/checking/debug instrumentation.
+  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::__base(__gnu_debug::__check_valid_range(__begin,
+								   __end)),
+	      __gnu_debug::__base(__end), __a)
+      { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    basic_string(basic_string&& __str)
+    : _Base(std::move(__str))
+    { }
+
+    basic_string(std::initializer_list<_CharT> __l,
+		 const _Allocator& __a = _Allocator())
+    : _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=(basic_string&& __str)
+    {
+      *static_cast<_Base*>(this) = std::move(__str);
+      this->_M_invalidate_all();
+      return *this;
+    }
+
+    basic_string&
+    operator=(std::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()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    using _Base::shrink_to_fit;
+#endif
+
+    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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    using _Base::front;
+    using _Base::back;
+#endif
+
+    // 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+=(std::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(__gnu_debug::__base(__first),
+		      __gnu_debug::__base(__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;
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    basic_string&
+    assign(basic_string&& __x)
+    {
+      _Base::assign(std::move(__x));
+      this->_M_invalidate_all();
+      return *this;
+    }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+    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(__gnu_debug::__base(__first),
+		      __gnu_debug::__base(__last));
+	this->_M_invalidate_all();
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    basic_string&
+    assign(std::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(), __gnu_debug::__base(__first),
+				  __gnu_debug::__base(__last));
+	this->_M_invalidate_all();
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    void
+    insert(iterator __p, std::initializer_list<_CharT> __l)
+    {
+      __glibcxx_check_insert(__p);
+      _Base::insert(__p.base(), __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,
+			    std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_map
new file mode 100644
index 0000000..43b1e9c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_map
@@ -0,0 +1,626 @@
+// Debugging unordered_map/unordered_multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+# include <unordered_map>
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::unordered_map with safety/checking/debug instrumentation.
+  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_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
+      public __gnu_debug::_Safe_sequence<unordered_map<_Key, _Tp, _Hash,
+						       _Pred, _Alloc> >
+    {
+      typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash,
+					    _Pred, _Alloc> _Base;
+      typedef __gnu_debug::_Safe_sequence<unordered_map> _Safe_base;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+
+    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<_Base_iterator,
+					  unordered_map> iterator;
+      typedef __gnu_debug::_Safe_iterator<_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 __first, _InputIterator __last, 
+		      size_type __n = 0,
+		      const hasher& __hf = hasher(), 
+		      const key_equal& __eql = key_equal(), 
+		      const allocator_type& __a = allocator_type())
+	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__last), __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::move(__x)), _Safe_base() { }
+
+      unordered_map(initializer_list<value_type> __l,
+		    size_type __n = 0,
+		    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 1204.
+	// 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)
+      {
+	std::pair<_Base_iterator, bool> __res = _Base::insert(__obj);
+	return std::make_pair(iterator(__res.first, this), __res.second);
+      }
+
+      iterator
+      insert(const_iterator __hint, const value_type& __obj)
+      {
+	__glibcxx_check_insert(__hint);
+	return iterator(_Base::insert(__hint.base(), __obj), this);
+      }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        std::pair<iterator, bool>
+        insert(_Pair&& __obj)
+        {
+	  std::pair<_Base_iterator, bool> __res =
+	    _Base::insert(std::forward<_Pair>(__obj));
+	  return std::make_pair(iterator(__res.first, this), __res.second);
+	}
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __hint, _Pair&& __obj)
+        {
+	  __glibcxx_check_insert(__hint);
+	  return iterator(_Base::insert(__hint.base(),
+					std::forward<_Pair>(__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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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)
+      {
+	std::pair<_Base_iterator, _Base_iterator> __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
+      {
+	std::pair<_Base_const_iterator, _Base_const_iterator> __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);
+	_Base_iterator __victim(_Base::find(__key));
+	if (__victim != _Base::end())
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim);
+	    __ret = 1;
+	  }
+	return __ret;
+      }
+
+      iterator
+      erase(const_iterator __it)
+      {
+	__glibcxx_check_erase(__it);
+	this->_M_invalidate_if(_Equal(__it.base()));
+	return iterator(_Base::erase(__it.base()), this);
+      }
+
+      iterator
+      erase(iterator __it)
+      { return erase(const_iterator(__it)); }
+
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __tmp = __first.base();
+	     __tmp != __last.base(); ++__tmp)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__tmp));
+	  }
+	return 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 __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+	this->_M_invalidate_if(_Not_equal(_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 bool
+    operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Key, typename _Tp, typename _Hash,
+	   typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+
+  /// Class std::unordered_multimap with safety/checking/debug instrumentation.
+  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_C::unordered_multimap<_Key, _Tp, _Hash,
+						_Pred, _Alloc>,
+      public __gnu_debug::_Safe_sequence<unordered_multimap<_Key, _Tp, _Hash,
+							    _Pred, _Alloc> >
+    {
+      typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
+						 _Pred, _Alloc> _Base;
+      typedef __gnu_debug::_Safe_sequence<unordered_multimap> _Safe_base;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+
+    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<_Base_iterator,
+					  unordered_multimap> iterator;
+      typedef __gnu_debug::_Safe_iterator<_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 __first, _InputIterator __last, 
+			   size_type __n = 0,
+			   const hasher& __hf = hasher(), 
+			   const key_equal& __eql = key_equal(), 
+			   const allocator_type& __a = allocator_type())
+	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__last), __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::move(__x)), _Safe_base() { }
+
+      unordered_multimap(initializer_list<value_type> __l,
+			 size_type __n = 0,
+			 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 1204.
+	// 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(const_iterator __hint, const value_type& __obj)
+      {
+	__glibcxx_check_insert(__hint);
+	return iterator(_Base::insert(__hint.base(), __obj), this);
+      }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(_Pair&& __obj)
+        { return iterator(_Base::insert(std::forward<_Pair>(__obj)), this); }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+	iterator
+	insert(const_iterator __hint, _Pair&& __obj)
+	{
+	  __glibcxx_check_insert(__hint);
+	  return iterator(_Base::insert(__hint.base(),
+					std::forward<_Pair>(__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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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)
+      {
+	std::pair<_Base_iterator, _Base_iterator> __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
+      {
+	std::pair<_Base_const_iterator, _Base_const_iterator> __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);
+	std::pair<_Base_iterator, _Base_iterator> __pair =
+	  _Base::equal_range(__key);
+	for (_Base_iterator __victim = __pair.first; __victim != __pair.second;)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim++);
+	    ++__ret;
+	  }
+	return __ret;
+      }
+
+      iterator
+      erase(const_iterator __it)
+      {
+	__glibcxx_check_erase(__it);
+	this->_M_invalidate_if(_Equal(__it.base()));
+	return iterator(_Base::erase(__it.base()), this);
+      }
+
+      iterator
+      erase(iterator __it)
+      { return erase(const_iterator(__it)); }
+
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __tmp = __first.base();
+	     __tmp != __last.base(); ++__tmp)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__tmp));
+	  }
+	return 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 __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+	this->_M_invalidate_if(_Not_equal(_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 bool
+    operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Key, typename _Tp, typename _Hash,
+	   typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+} // namespace __debug
+} // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_set
new file mode 100644
index 0000000..cf21a3c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_set
@@ -0,0 +1,604 @@
+// Debugging unordered_set/unordered_multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+# include <unordered_set>
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::unordered_set with safety/checking/debug instrumentation.
+  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_C::unordered_set<_Value, _Hash, _Pred, _Alloc>,
+      public __gnu_debug::_Safe_sequence<unordered_set<_Value, _Hash,
+						       _Pred, _Alloc> >
+    {
+      typedef _GLIBCXX_STD_C::unordered_set<_Value, _Hash,
+					    _Pred, _Alloc> _Base;
+      typedef __gnu_debug::_Safe_sequence<unordered_set> _Safe_base;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+
+    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<_Base_iterator,
+					  unordered_set> iterator;
+      typedef __gnu_debug::_Safe_iterator<_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 __first, _InputIterator __last, 
+		      size_type __n = 0,
+		      const hasher& __hf = hasher(), 
+		      const key_equal& __eql = key_equal(), 
+		      const allocator_type& __a = allocator_type())
+	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__last), __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::move(__x)), _Safe_base() { }
+
+      unordered_set(initializer_list<value_type> __l,
+		    size_type __n = 0,
+		    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 1204.
+	// 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<_Base_iterator, bool> __pair_type;
+	__pair_type __res = _Base::insert(__obj);
+	return std::make_pair(iterator(__res.first, this), __res.second);
+      }
+
+      iterator
+      insert(const_iterator __hint, const value_type& __obj)
+      {
+	__glibcxx_check_insert(__hint);
+	return iterator(_Base::insert(__hint.base(), __obj), this);
+      }
+
+      std::pair<iterator, bool>
+      insert(value_type&& __obj)
+      {
+	typedef std::pair<typename _Base::iterator, bool> __pair_type;
+	__pair_type __res = _Base::insert(std::move(__obj));
+	return std::make_pair(iterator(__res.first, this), __res.second);
+      }
+
+      iterator
+      insert(const_iterator __hint, value_type&& __obj)
+      {
+	__glibcxx_check_insert(__hint);
+	return iterator(_Base::insert(__hint.base(), std::move(__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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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 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
+      {
+	std::pair<_Base_const_iterator, _Base_const_iterator>
+	  __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);
+	_Base_iterator __victim(_Base::find(__key));
+	if (__victim != _Base::end())
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim);
+	    __ret = 1;
+	  }
+	return __ret;
+      }
+
+      iterator
+      erase(const_iterator __it)
+      {
+	__glibcxx_check_erase(__it);
+	this->_M_invalidate_if(_Equal(__it.base()));
+	return iterator(_Base::erase(__it.base()), this);
+      }
+
+      iterator
+      erase(iterator __it)
+      { return erase(const_iterator(__it)); }
+
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __tmp = __first.base();
+	     __tmp != __last.base(); ++__tmp)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__tmp));
+	  }
+	return 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 __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+	this->_M_invalidate_if(_Not_equal(_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 bool
+    operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+
+  /// Class std::unordered_multiset with safety/checking/debug instrumentation.
+  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_C::unordered_multiset<_Value, _Hash, _Pred, _Alloc>,
+      public __gnu_debug::_Safe_sequence<unordered_multiset<_Value, _Hash,
+							    _Pred, _Alloc> >
+    {
+      typedef _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash,
+						 _Pred, _Alloc> _Base;
+      typedef __gnu_debug::_Safe_sequence<unordered_multiset> _Safe_base;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef typename _Base::iterator _Base_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+
+    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<_Base_iterator,
+					  unordered_multiset> iterator;
+      typedef __gnu_debug::_Safe_iterator<_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 __first, _InputIterator __last, 
+			   size_type __n = 0,
+			   const hasher& __hf = hasher(), 
+			   const key_equal& __eql = key_equal(), 
+			   const allocator_type& __a = allocator_type())
+	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__last), __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::move(__x)), _Safe_base() { }
+
+      unordered_multiset(initializer_list<value_type> __l,
+			 size_type __n = 0,
+			 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 1204.
+        // 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(const_iterator __hint, const value_type& __obj)
+      {
+	__glibcxx_check_insert(__hint);
+	return iterator(_Base::insert(__hint.base(), __obj), this);
+      }
+
+      iterator
+      insert(value_type&& __obj)
+      { return iterator(_Base::insert(std::move(__obj)), this); }
+
+      iterator
+      insert(const_iterator __hint, value_type&& __obj)
+      {
+	__glibcxx_check_insert(__hint);
+	return iterator(_Base::insert(__hint.base(), std::move(__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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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 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
+      {
+	std::pair<_Base_const_iterator, _Base_const_iterator>
+	  __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);
+	std::pair<_Base_iterator, _Base_iterator> __pair =
+	  _Base::equal_range(__key);
+	for (_Base_iterator __victim = __pair.first; __victim != __pair.second;)
+	  {
+	    this->_M_invalidate_if(_Equal(__victim));
+	    _Base::erase(__victim++);
+	    ++__ret;
+	  }
+	return __ret;
+      }
+
+      iterator
+      erase(const_iterator __it)
+      {
+	__glibcxx_check_erase(__it);
+	this->_M_invalidate_if(_Equal(__it.base()));
+	return iterator(_Base::erase(__it.base()), this);
+      }
+
+      iterator
+      erase(iterator __it)
+      { return erase(const_iterator(__it)); }
+
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      {
+	__glibcxx_check_erase_range(__first, __last);
+	for (_Base_const_iterator __tmp = __first.base();
+	     __tmp != __last.base(); ++__tmp)
+	  {
+	    _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(),
+				  _M_message(__gnu_debug::__msg_valid_range)
+				  ._M_iterator(__first, "first")
+				  ._M_iterator(__last, "last"));
+	    this->_M_invalidate_if(_Equal(__tmp));
+	  }
+	return 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 __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+	this->_M_invalidate_if(_Not_equal(_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 bool
+    operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+} // namespace __debug
+} // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/vector b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/vector
new file mode 100644
index 0000000..edb1f88
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/vector
@@ -0,0 +1,610 @@
+// Debugging vector implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace __debug
+{
+  /// Class std::vector with safety/checking/debug instrumentation.
+  template<typename _Tp,
+	   typename _Allocator = std::allocator<_Tp> >
+    class vector
+    : public _GLIBCXX_STD_C::vector<_Tp, _Allocator>,
+      public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> >
+    {
+      typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base;
+      typedef __gnu_debug::_Safe_sequence<vector>              _Safe_base;
+
+      typedef typename _Base::iterator _Base_iterator;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+      typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
+
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef __gnu_debug::_Safe_iterator<_Base_iterator,vector>
+      iterator;
+      typedef __gnu_debug::_Safe_iterator<_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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+      vector(size_type __n)
+      : _Base(__n), _M_guaranteed_capacity(__n) { }
+
+      vector(size_type __n, const _Tp& __value,
+	     const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }
+#else
+      explicit
+      vector(size_type __n, const _Tp& __value = _Tp(),
+	     const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }
+#endif
+
+      template<class _InputIterator>
+        vector(_InputIterator __first, _InputIterator __last,
+	       const _Allocator& __a = _Allocator())
+        : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
+								     __last)),
+		__gnu_debug::__base(__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::move(__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 1204.
+	// 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(__gnu_debug::__base(__first),
+			__gnu_debug::__base(__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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      resize(size_type __sz)
+      {
+	bool __realloc = _M_requires_reallocation(__sz);
+	if (__sz < this->size())
+	  this->_M_invalidate_after_nth(__sz);
+	_Base::resize(__sz);
+	if (__realloc)
+	  this->_M_invalidate_all();
+	_M_update_guaranteed_capacity();
+      }
+
+      void
+      resize(size_type __sz, const _Tp& __c)
+      {
+	bool __realloc = _M_requires_reallocation(__sz);
+	if (__sz < this->size())
+	  this->_M_invalidate_after_nth(__sz);
+	_Base::resize(__sz, __c);
+	if (__realloc)
+	  this->_M_invalidate_all();
+	_M_update_guaranteed_capacity();
+      }
+#else
+      void
+      resize(size_type __sz, _Tp __c = _Tp())
+      {
+	bool __realloc = _M_requires_reallocation(__sz);
+	if (__sz < this->size())
+	  this->_M_invalidate_after_nth(__sz);
+	_Base::resize(__sz, __c);
+	if (__realloc)
+	  this->_M_invalidate_all();
+	_M_update_guaranteed_capacity();
+      }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::shrink_to_fit;
+#endif
+
+      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();
+	this->_M_invalidate_if(_Equal(--_Base::end()));
+	_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.base() - _Base::begin();
+	  _Base_iterator __res = _Base::emplace(__position.base(),
+						std::forward<_Args>(__args)...);
+	  if (__realloc)
+	    this->_M_invalidate_all();
+	  else
+	    this->_M_invalidate_after_nth(__offset);
+	  _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.base() - _Base::begin();
+	_Base_iterator __res = _Base::insert(__position.base(), __x);
+	if (__realloc)
+	  this->_M_invalidate_all();
+	else
+	  this->_M_invalidate_after_nth(__offset);
+	_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.base() - _Base::begin();
+	_Base::insert(__position.base(), __n, __x);
+	if (__realloc)
+	  this->_M_invalidate_all();
+	else
+	  this->_M_invalidate_after_nth(__offset);
+	_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. */
+	  _Base_iterator __old_begin = _M_base().begin();
+	  difference_type __offset = __position.base() - _Base::begin();
+	  _Base::insert(__position.base(), __gnu_debug::__base(__first),
+					   __gnu_debug::__base(__last));
+
+	  if (_M_base().begin() != __old_begin)
+	    this->_M_invalidate_all();
+	  else
+	    this->_M_invalidate_after_nth(__offset);
+	  _M_update_guaranteed_capacity();
+	}
+
+      iterator
+      erase(iterator __position)
+      {
+	__glibcxx_check_erase(__position);
+	difference_type __offset = __position.base() - _Base::begin();
+	_Base_iterator __res = _Base::erase(__position.base());
+	this->_M_invalidate_after_nth(__offset);
+	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.base() != __last.base())
+	  {
+	    difference_type __offset = __first.base() - _Base::begin();
+	    _Base_iterator __res = _Base::erase(__first.base(),
+						__last.base());
+	    this->_M_invalidate_after_nth(__offset);
+	    return iterator(__res, this);
+	  }
+	else
+	  return __first;
+      }
+
+      void
+      swap(vector& __x)
+      {
+	_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();
+      }
+
+      void
+      _M_invalidate_after_nth(difference_type __n)
+      {
+	typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
+	this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
+      }
+    };
+
+  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); }
+
+} // namespace __debug
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // DR 1182.
+  /// std::hash specialization for vector<bool>.
+  template<typename _Alloc>
+    struct hash<__debug::vector<bool, _Alloc>>
+    : public __hash_base<size_t, __debug::vector<bool, _Alloc>>
+    {
+      size_t
+      operator()(const __debug::vector<bool, _Alloc>& __b) const noexcept
+      { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()
+	  (__b._M_base()); }
+    };
+#endif
+
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal
new file mode 100644
index 0000000..d65b814
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal
@@ -0,0 +1,485 @@
+// <decimal> -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file decimal/decimal
+ *  This is a Standard C++ Library header.
+ */
+
+// ISO/IEC TR 24733 
+// Written by Janis Johnson <janis187@us.ibm.com>
+
+#ifndef _GLIBCXX_DECIMAL
+#define _GLIBCXX_DECIMAL 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#ifndef _GLIBCXX_USE_DECIMAL_FLOAT
+#error This file requires compiler and library support for ISO/IEC TR 24733 \
+that is currently not available.
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  /**
+    * @defgroup decimal Decimal Floating-Point Arithmetic
+    * @ingroup numerics
+    *
+    * Classes and functions for decimal floating-point arithmetic.
+    * @{
+    */
+
+  /** @namespace std::decimal
+    * @brief ISO/IEC TR 24733 Decimal floating-point arithmetic.
+    */
+namespace decimal
+{
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  class decimal32;
+  class decimal64;
+  class decimal128;
+
+  // 3.2.5  Initialization from coefficient and exponent.
+  static decimal32 make_decimal32(long long __coeff, int __exp);
+  static decimal32 make_decimal32(unsigned long long __coeff, int __exp);
+  static decimal64 make_decimal64(long long __coeff, int __exp);
+  static decimal64 make_decimal64(unsigned long long __coeff, int __exp);
+  static decimal128 make_decimal128(long long __coeff, int __exp);
+  static decimal128 make_decimal128(unsigned long long __coeff, int __exp);
+
+  /// Non-conforming extension: Conversion to integral type.
+  long long decimal32_to_long_long(decimal32 __d);
+  long long decimal64_to_long_long(decimal64 __d);
+  long long decimal128_to_long_long(decimal128 __d);
+  long long decimal_to_long_long(decimal32 __d);
+  long long decimal_to_long_long(decimal64 __d);
+  long long decimal_to_long_long(decimal128 __d);
+
+  // 3.2.6  Conversion to generic floating-point type.
+  float decimal32_to_float(decimal32 __d);
+  float decimal64_to_float(decimal64 __d);
+  float decimal128_to_float(decimal128 __d);
+  float decimal_to_float(decimal32 __d);
+  float decimal_to_float(decimal64 __d);
+  float decimal_to_float(decimal128 __d);
+
+  double decimal32_to_double(decimal32 __d);
+  double decimal64_to_double(decimal64 __d);
+  double decimal128_to_double(decimal128 __d);
+  double decimal_to_double(decimal32 __d);
+  double decimal_to_double(decimal64 __d);
+  double decimal_to_double(decimal128 __d);
+
+  long double decimal32_to_long_double(decimal32 __d);
+  long double decimal64_to_long_double(decimal64 __d);
+  long double decimal128_to_long_double(decimal128 __d);
+  long double decimal_to_long_double(decimal32 __d);
+  long double decimal_to_long_double(decimal64 __d);
+  long double decimal_to_long_double(decimal128 __d);
+
+  // 3.2.7  Unary arithmetic operators.
+  decimal32  operator+(decimal32 __rhs);
+  decimal64  operator+(decimal64 __rhs);
+  decimal128 operator+(decimal128 __rhs);
+  decimal32  operator-(decimal32 __rhs);
+  decimal64  operator-(decimal64 __rhs);
+  decimal128 operator-(decimal128 __rhs);
+
+  // 3.2.8  Binary arithmetic operators.
+#define _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3)	\
+  _T1 operator _Op(_T2 __lhs, _T3 __rhs);
+#define _DECLARE_DECIMAL_BINARY_OP_WITH_INT(_Op, _Tp)		\
+  _Tp operator _Op(_Tp __lhs, int __rhs);			\
+  _Tp operator _Op(_Tp __lhs, unsigned int __rhs);		\
+  _Tp operator _Op(_Tp __lhs, long __rhs);			\
+  _Tp operator _Op(_Tp __lhs, unsigned long __rhs);		\
+  _Tp operator _Op(_Tp __lhs, long long __rhs);			\
+  _Tp operator _Op(_Tp __lhs, unsigned long long __rhs);	\
+  _Tp operator _Op(int __lhs, _Tp __rhs);			\
+  _Tp operator _Op(unsigned int __lhs, _Tp __rhs);		\
+  _Tp operator _Op(long __lhs, _Tp __rhs);			\
+  _Tp operator _Op(unsigned long __lhs, _Tp __rhs);		\
+  _Tp operator _Op(long long __lhs, _Tp __rhs);			\
+  _Tp operator _Op(unsigned long long __lhs, _Tp __rhs);
+
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128)
+
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128)
+
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128)
+
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128)
+  _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128)
+
+#undef _DECLARE_DECIMAL_BINARY_OP_WITH_DEC
+#undef _DECLARE_DECIMAL_BINARY_OP_WITH_INT
+
+  // 3.2.9  Comparison operators.
+#define _DECLARE_DECIMAL_COMPARISON(_Op, _Tp)				\
+  bool operator _Op(_Tp __lhs, decimal32 __rhs);			\
+  bool operator _Op(_Tp __lhs, decimal64 __rhs);			\
+  bool operator _Op(_Tp __lhs, decimal128 __rhs);			\
+  bool operator _Op(_Tp __lhs, int __rhs);				\
+  bool operator _Op(_Tp __lhs, unsigned int __rhs);			\
+  bool operator _Op(_Tp __lhs, long __rhs);				\
+  bool operator _Op(_Tp __lhs, unsigned long __rhs);			\
+  bool operator _Op(_Tp __lhs, long long __rhs);			\
+  bool operator _Op(_Tp __lhs, unsigned long long __rhs);		\
+  bool operator _Op(int __lhs, _Tp __rhs);				\
+  bool operator _Op(unsigned int __lhs, _Tp __rhs);			\
+  bool operator _Op(long __lhs, _Tp __rhs);				\
+  bool operator _Op(unsigned long __lhs, _Tp __rhs);			\
+  bool operator _Op(long long __lhs, _Tp __rhs);			\
+  bool operator _Op(unsigned long long __lhs, _Tp __rhs);
+
+  _DECLARE_DECIMAL_COMPARISON(==, decimal32)
+  _DECLARE_DECIMAL_COMPARISON(==, decimal64)
+  _DECLARE_DECIMAL_COMPARISON(==, decimal128)
+
+  _DECLARE_DECIMAL_COMPARISON(!=, decimal32)
+  _DECLARE_DECIMAL_COMPARISON(!=, decimal64)
+  _DECLARE_DECIMAL_COMPARISON(!=, decimal128)
+
+  _DECLARE_DECIMAL_COMPARISON(<, decimal32)
+  _DECLARE_DECIMAL_COMPARISON(<, decimal64)
+  _DECLARE_DECIMAL_COMPARISON(<, decimal128)
+
+  _DECLARE_DECIMAL_COMPARISON(>=, decimal32)
+  _DECLARE_DECIMAL_COMPARISON(>=, decimal64)
+  _DECLARE_DECIMAL_COMPARISON(>=, decimal128)
+
+  _DECLARE_DECIMAL_COMPARISON(>, decimal32)
+  _DECLARE_DECIMAL_COMPARISON(>, decimal64)
+  _DECLARE_DECIMAL_COMPARISON(>, decimal128)
+
+  _DECLARE_DECIMAL_COMPARISON(>=, decimal32)
+  _DECLARE_DECIMAL_COMPARISON(>=, decimal64)
+  _DECLARE_DECIMAL_COMPARISON(>=, decimal128)
+
+#undef _DECLARE_DECIMAL_COMPARISON
+
+  /// 3.2.2  Class decimal32.
+  class decimal32
+  {
+  public:
+    typedef float __decfloat32 __attribute__((mode(SD)));
+
+    // 3.2.2.2  Construct/copy/destroy.
+    decimal32()					: __val(0.e-101DF) {}
+
+    // 3.2.2.3  Conversion from floating-point type.
+    explicit decimal32(decimal64 __d64);
+    explicit decimal32(decimal128 __d128);
+    explicit decimal32(float __r)		: __val(__r) {}
+    explicit decimal32(double __r)		: __val(__r) {}
+    explicit decimal32(long double __r)		: __val(__r) {}
+
+    // 3.2.2.4  Conversion from integral type.
+    decimal32(int __z)				: __val(__z) {}
+    decimal32(unsigned int __z)			: __val(__z) {}
+    decimal32(long __z)				: __val(__z) {}
+    decimal32(unsigned long __z)		: __val(__z) {}
+    decimal32(long long __z)			: __val(__z) {}
+    decimal32(unsigned long long __z)		: __val(__z) {}
+
+    /// Conforming extension: Conversion from scalar decimal type.
+    decimal32(__decfloat32 __z)			: __val(__z) {}
+
+    // 3.2.2.5  Conversion to integral type. (DISABLED)
+    //operator long long() const { return (long long)__val; }
+
+    // 3.2.2.6  Increment and decrement operators.
+    decimal32& operator++()
+    {
+      __val += 1;
+      return *this;
+    }
+
+    decimal32 operator++(int)
+    {
+      decimal32 __tmp = *this;
+      __val += 1;
+      return __tmp;
+    }
+
+    decimal32& operator--()
+    {
+      __val -= 1;
+      return *this;
+    }
+
+    decimal32   operator--(int)
+    {
+      decimal32 __tmp = *this;
+      __val -= 1;
+      return __tmp;
+    }
+
+    // 3.2.2.7  Compound assignment.
+#define _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(_Op)	\
+    decimal32& operator _Op(decimal32 __rhs);		\
+    decimal32& operator _Op(decimal64 __rhs);		\
+    decimal32& operator _Op(decimal128 __rhs);		\
+    decimal32& operator _Op(int __rhs);			\
+    decimal32& operator _Op(unsigned int __rhs);	\
+    decimal32& operator _Op(long __rhs);		\
+    decimal32& operator _Op(unsigned long __rhs);	\
+    decimal32& operator _Op(long long __rhs);		\
+    decimal32& operator _Op(unsigned long long __rhs);
+
+    _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(+=)
+    _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(-=)
+    _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(*=)
+    _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(/=)
+#undef _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT
+
+  private:
+    __decfloat32 __val;
+
+  public:
+    __decfloat32 __getval(void) { return __val; }
+    void __setval(__decfloat32 __x) { __val = __x; }
+  };
+
+  /// 3.2.3  Class decimal64.
+  class decimal64
+  {
+  public:
+    typedef float __decfloat64 __attribute__((mode(DD)));
+
+    // 3.2.3.2  Construct/copy/destroy.
+    decimal64()					: __val(0.e-398dd) {}
+
+    // 3.2.3.3  Conversion from floating-point type.
+	     decimal64(decimal32 d32);
+    explicit decimal64(decimal128 d128);
+    explicit decimal64(float __r)		: __val(__r) {}
+    explicit decimal64(double __r)		: __val(__r) {}
+    explicit decimal64(long double __r)		: __val(__r) {}
+
+    // 3.2.3.4  Conversion from integral type.
+    decimal64(int __z)				: __val(__z) {}
+    decimal64(unsigned int __z)			: __val(__z) {}
+    decimal64(long __z)				: __val(__z) {}
+    decimal64(unsigned long __z)		: __val(__z) {}
+    decimal64(long long __z)			: __val(__z) {}
+    decimal64(unsigned long long __z)		: __val(__z) {}
+
+    /// Conforming extension: Conversion from scalar decimal type.
+    decimal64(__decfloat64 __z)			: __val(__z) {}
+
+    // 3.2.3.5  Conversion to integral type. (DISABLED)
+    //operator long long() const { return (long long)__val; }
+
+    // 3.2.3.6  Increment and decrement operators.
+    decimal64& operator++()
+    {
+      __val += 1;
+      return *this;
+    }
+
+    decimal64 operator++(int)
+    {
+      decimal64 __tmp = *this;
+      __val += 1;
+      return __tmp;
+    }
+
+    decimal64& operator--()
+    {
+      __val -= 1;
+      return *this;
+    }
+
+    decimal64 operator--(int)
+    {
+      decimal64 __tmp = *this;
+      __val -= 1;
+      return __tmp;
+    }
+
+    // 3.2.3.7  Compound assignment.
+#define _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(_Op)	\
+    decimal64& operator _Op(decimal32 __rhs);		\
+    decimal64& operator _Op(decimal64 __rhs);		\
+    decimal64& operator _Op(decimal128 __rhs);		\
+    decimal64& operator _Op(int __rhs);			\
+    decimal64& operator _Op(unsigned int __rhs);	\
+    decimal64& operator _Op(long __rhs);		\
+    decimal64& operator _Op(unsigned long __rhs);	\
+    decimal64& operator _Op(long long __rhs);		\
+    decimal64& operator _Op(unsigned long long __rhs);
+
+    _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(+=)
+    _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(-=)
+    _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(*=)
+    _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(/=)
+#undef _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT
+
+  private:
+    __decfloat64 __val;
+
+  public:
+    __decfloat64 __getval(void) { return __val; }
+    void __setval(__decfloat64 __x) { __val = __x; }
+  };
+
+  /// 3.2.4  Class decimal128.
+  class decimal128
+  {
+  public:
+    typedef float __decfloat128 __attribute__((mode(TD)));
+
+    // 3.2.4.2  Construct/copy/destroy.
+    decimal128()				: __val(0.e-6176DL) {}
+
+    // 3.2.4.3  Conversion from floating-point type.
+	     decimal128(decimal32 d32);
+	     decimal128(decimal64 d64);
+    explicit decimal128(float __r)		: __val(__r) {}
+    explicit decimal128(double __r)		: __val(__r) {}
+    explicit decimal128(long double __r)	: __val(__r) {}
+
+
+    // 3.2.4.4  Conversion from integral type.
+    decimal128(int __z)				: __val(__z) {}
+    decimal128(unsigned int __z)		: __val(__z) {}
+    decimal128(long __z)			: __val(__z) {}
+    decimal128(unsigned long __z)		: __val(__z) {}
+    decimal128(long long __z)			: __val(__z) {}
+    decimal128(unsigned long long __z)		: __val(__z) {}
+
+    /// Conforming extension: Conversion from scalar decimal type.
+    decimal128(__decfloat128 __z)		: __val(__z) {}
+
+    // 3.2.4.5  Conversion to integral type. (DISABLED)
+    //operator long long() const { return (long long)__val; }
+
+    // 3.2.4.6  Increment and decrement operators.
+    decimal128& operator++()
+    {
+      __val += 1;
+      return *this;
+    }
+
+    decimal128 operator++(int)
+    {
+      decimal128 __tmp = *this;
+      __val += 1;
+      return __tmp;
+    }
+
+    decimal128& operator--()
+    {
+      __val -= 1;
+      return *this;
+    }
+
+    decimal128   operator--(int)
+    {
+      decimal128 __tmp = *this;
+      __val -= 1;
+      return __tmp;
+    }
+
+    // 3.2.4.7  Compound assignment.
+#define _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(_Op)	\
+    decimal128& operator _Op(decimal32 __rhs);		\
+    decimal128& operator _Op(decimal64 __rhs);		\
+    decimal128& operator _Op(decimal128 __rhs);		\
+    decimal128& operator _Op(int __rhs);		\
+    decimal128& operator _Op(unsigned int __rhs);	\
+    decimal128& operator _Op(long __rhs);		\
+    decimal128& operator _Op(unsigned long __rhs);	\
+    decimal128& operator _Op(long long __rhs);		\
+    decimal128& operator _Op(unsigned long long __rhs);
+
+    _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(+=)
+    _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(-=)
+    _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(*=)
+    _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(/=)
+#undef _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT
+
+  private:
+    __decfloat128 __val;
+
+  public:
+    __decfloat128 __getval(void) { return __val; }
+    void __setval(__decfloat128 __x) { __val = __x; }
+  };
+
+#define _GLIBCXX_USE_DECIMAL_ 1
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+} // namespace decimal
+  // @} group decimal
+} // namespace std
+
+#include <decimal/decimal.h>
+
+#endif /* _GLIBCXX_DECIMAL */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal.h
new file mode 100644
index 0000000..f8f0573
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal.h
@@ -0,0 +1,468 @@
+// decimal classes -*- C++ -*-
+
+// Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file decimal/decimal.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{decimal}
+ */
+
+// ISO/IEC TR 24733
+// Written by Janis Johnson <janis187@us.ibm.com>
+
+#ifndef _GLIBCXX_DECIMAL_IMPL
+#define _GLIBCXX_DECIMAL_IMPL 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace decimal
+{
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // ISO/IEC TR 24733  3.2.[234].1  Construct/copy/destroy.
+
+  inline decimal32::decimal32(decimal64 __r)	: __val(__r.__getval()) {}
+  inline decimal32::decimal32(decimal128 __r)	: __val(__r.__getval()) {}
+  inline decimal64::decimal64(decimal32 __r)	: __val(__r.__getval()) {}
+  inline decimal64::decimal64(decimal128 __r)	: __val(__r.__getval()) {}
+  inline decimal128::decimal128(decimal32 __r)	: __val(__r.__getval()) {}
+  inline decimal128::decimal128(decimal64 __r)	: __val(__r.__getval()) {}
+
+  // ISO/IEC TR 24733  3.2.[234].6  Compound assignment.
+
+#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2)	 \
+  inline _T1& _T1::operator _Op1(_T2 __rhs)				 \
+  {									 \
+    __setval(__getval() _Op2 __rhs.__getval());				 \
+    return *this;							 \
+  }
+
+#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2)	 \
+  inline _T1& _T1::operator _Op1(_T2 __rhs)				 \
+  {									 \
+    __setval(__getval() _Op2 __rhs);					 \
+    return *this;							 \
+  }
+
+#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_Op1, _Op2, _T1)		 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal32)	 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal64)	 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal128)	 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, int)		 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned int) \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long)	 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long)\
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long long)	 \
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long long)
+
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal32)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal32)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal32)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal32)
+
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal64)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal64)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal64)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal64)
+
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal128)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal128)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal128)
+  _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal128)
+
+#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC
+#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT
+#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS
+
+  // Extension: Conversion to integral type.
+
+  inline long long decimal32_to_long_long(decimal32 __d)
+  { return (long long)__d.__getval(); }
+
+  inline long long decimal64_to_long_long(decimal64 __d)
+  { return (long long)__d.__getval(); }
+
+  inline long long decimal128_to_long_long(decimal128 __d)
+  { return (long long)__d.__getval(); }
+
+  inline long long decimal_to_long_long(decimal32 __d)
+  { return (long long)__d.__getval(); }
+
+  inline long long decimal_to_long_long(decimal64 __d)
+  { return (long long)__d.__getval(); }
+
+  inline long long decimal_to_long_long(decimal128 __d)
+  { return (long long)__d.__getval(); }
+
+  // ISO/IEC TR 24733  3.2.5  Initialization from coefficient and exponent.
+
+  static decimal32 make_decimal32(long long __coeff, int __exponent)
+  {
+    decimal32 __decexp = 1, __multiplier;
+
+    if (__exponent < 0)
+      {
+	__multiplier = 1.E-1DF;
+	__exponent = -__exponent;
+      }
+    else
+      __multiplier = 1.E1DF;
+
+    for (int __i = 0; __i < __exponent; ++__i)
+      __decexp *= __multiplier;
+
+    return __coeff * __decexp;
+  }
+
+  static decimal32 make_decimal32(unsigned long long __coeff, int __exponent)
+  {
+    decimal32 __decexp = 1, __multiplier;
+
+    if (__exponent < 0)
+      {
+	__multiplier = 1.E-1DF;
+	__exponent = -__exponent;
+      }
+    else
+      __multiplier = 1.E1DF;
+
+    for (int __i = 0; __i < __exponent; ++__i)
+      __decexp *= __multiplier;
+
+    return __coeff * __decexp;
+  }
+
+  static decimal64 make_decimal64(long long __coeff, int __exponent)
+  {
+    decimal64 __decexp = 1, __multiplier;
+
+    if (__exponent < 0)
+      {
+	__multiplier = 1.E-1DD;
+	__exponent = -__exponent;
+      }
+    else
+      __multiplier = 1.E1DD;
+
+    for (int __i = 0; __i < __exponent; ++__i)
+      __decexp *= __multiplier;
+
+    return __coeff * __decexp;
+  }
+
+  static decimal64 make_decimal64(unsigned long long __coeff, int __exponent)
+  {
+    decimal64 __decexp = 1, __multiplier;
+
+    if (__exponent < 0)
+      {
+	__multiplier = 1.E-1DD;
+	__exponent = -__exponent;
+      }
+    else
+      __multiplier = 1.E1DD;
+
+    for (int __i = 0; __i < __exponent; ++__i)
+      __decexp *= __multiplier;
+
+    return __coeff * __decexp;
+  }
+
+  static decimal128 make_decimal128(long long __coeff, int __exponent)
+  {
+    decimal128 __decexp = 1, __multiplier;
+
+    if (__exponent < 0)
+      {
+	__multiplier = 1.E-1DL;
+	__exponent = -__exponent;
+      }
+    else
+      __multiplier = 1.E1DL;
+
+    for (int __i = 0; __i < __exponent; ++__i)
+      __decexp *= __multiplier;
+
+    return __coeff * __decexp;
+  }
+
+  static decimal128 make_decimal128(unsigned long long __coeff, int __exponent)
+  {
+    decimal128 __decexp = 1, __multiplier;
+
+    if (__exponent < 0)
+      {
+	__multiplier = 1.E-1DL;
+	__exponent = -__exponent;
+      }
+    else
+      __multiplier = 1.E1DL;
+
+    for (int __i = 0; __i < __exponent; ++__i)
+      __decexp *= __multiplier;
+
+    return __coeff * __decexp;
+  }
+
+  // ISO/IEC TR 24733  3.2.6  Conversion to generic floating-point type.
+
+  inline float decimal32_to_float(decimal32 __d)
+  { return (float)__d.__getval(); }
+
+  inline float decimal64_to_float(decimal64 __d)
+  { return (float)__d.__getval(); }
+
+  inline float decimal128_to_float(decimal128 __d)
+  { return (float)__d.__getval(); }
+
+  inline float decimal_to_float(decimal32 __d)
+  { return (float)__d.__getval(); }
+
+  inline float decimal_to_float(decimal64 __d)
+  { return (float)__d.__getval(); }
+
+  inline float decimal_to_float(decimal128 __d)
+  { return (float)__d.__getval(); }
+
+  inline double decimal32_to_double(decimal32 __d)
+  { return (double)__d.__getval(); }
+
+  inline double decimal64_to_double(decimal64 __d)
+  { return (double)__d.__getval(); }
+
+  inline double decimal128_to_double(decimal128 __d)
+  { return (double)__d.__getval(); }
+
+  inline double decimal_to_double(decimal32 __d)
+  { return (double)__d.__getval(); }
+
+  inline double decimal_to_double(decimal64 __d)
+  { return (double)__d.__getval(); }
+
+  inline double decimal_to_double(decimal128 __d)
+  { return (double)__d.__getval(); }
+
+  inline long double decimal32_to_long_double(decimal32 __d)
+  { return (long double)__d.__getval(); }
+
+  inline long double decimal64_to_long_double(decimal64 __d)
+  { return (long double)__d.__getval(); }
+
+  inline long double decimal128_to_long_double(decimal128 __d)
+  { return (long double)__d.__getval(); }
+
+  inline long double decimal_to_long_double(decimal32 __d)
+  { return (long double)__d.__getval(); }
+
+  inline long double decimal_to_long_double(decimal64 __d)
+  { return (long double)__d.__getval(); }
+
+  inline long double decimal_to_long_double(decimal128 __d)
+  { return (long double)__d.__getval(); }
+
+  // ISO/IEC TR 24733  3.2.7  Unary arithmetic operators.
+
+#define _DEFINE_DECIMAL_UNARY_OP(_Op, _Tp)	\
+  inline _Tp operator _Op(_Tp __rhs)		\
+  {						\
+    _Tp __tmp;					\
+    __tmp.__setval(0 _Op __rhs.__getval());	\
+    return __tmp;				\
+  }
+
+  _DEFINE_DECIMAL_UNARY_OP(+, decimal32)
+  _DEFINE_DECIMAL_UNARY_OP(+, decimal64)
+  _DEFINE_DECIMAL_UNARY_OP(+, decimal128)
+  _DEFINE_DECIMAL_UNARY_OP(-, decimal32)
+  _DEFINE_DECIMAL_UNARY_OP(-, decimal64)
+  _DEFINE_DECIMAL_UNARY_OP(-, decimal128)
+
+#undef _DEFINE_DECIMAL_UNARY_OP
+
+  // ISO/IEC TR 24733  3.2.8  Binary arithmetic operators.
+
+#define _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3)	\
+  inline _T1 operator _Op(_T2 __lhs, _T3 __rhs)			\
+  {								\
+    _T1 __retval;						\
+    __retval.__setval(__lhs.__getval() _Op __rhs.__getval());	\
+    return __retval;						\
+  }
+
+#define _DEFINE_DECIMAL_BINARY_OP_BOTH(_Op, _T1, _T2, _T3)	\
+  inline _T1 operator _Op(_T2 __lhs, _T3 __rhs)			\
+  {								\
+    _T1 __retval;						\
+    __retval.__setval(__lhs.__getval() _Op __rhs.__getval());	\
+    return __retval;						\
+  }
+
+#define _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, _T2)		\
+  inline _T1 operator _Op(_T1 __lhs, _T2 __rhs)			\
+  {								\
+    _T1 __retval;						\
+    __retval.__setval(__lhs.__getval() _Op __rhs);		\
+    return __retval;						\
+  }
+
+#define _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, _T2)		\
+  inline _T1 operator _Op(_T2 __lhs, _T1 __rhs)			\
+  {								\
+    _T1 __retval;						\
+    __retval.__setval(__lhs _Op __rhs.__getval());		\
+    return __retval;						\
+  }
+
+#define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op, _T1)		\
+  _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, int);			\
+  _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned int);	\
+  _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long);		\
+  _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long);	\
+  _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long long);		\
+  _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long long);	\
+  _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, int);			\
+  _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned int);	\
+  _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long);		\
+  _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long);	\
+  _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long long);		\
+  _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long long);	\
+
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128)
+
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128)
+
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128)
+
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128)
+  _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128)
+
+#undef _DEFINE_DECIMAL_BINARY_OP_WITH_DEC
+#undef _DEFINE_DECIMAL_BINARY_OP_BOTH
+#undef _DEFINE_DECIMAL_BINARY_OP_LHS
+#undef _DEFINE_DECIMAL_BINARY_OP_RHS
+#undef _DEFINE_DECIMAL_BINARY_OP_WITH_INT
+
+  // ISO/IEC TR 24733  3.2.9  Comparison operators.
+
+#define _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _T1, _T2)	\
+  inline bool operator _Op(_T1 __lhs, _T2 __rhs)	\
+  { return __lhs.__getval() _Op __rhs.__getval(); }
+
+#define _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _T1, _T2)	\
+  inline bool operator _Op(_T1 __lhs, _T2 __rhs)	\
+  { return __lhs.__getval() _Op __rhs; }
+
+#define _DEFINE_DECIMAL_COMPARISON_RHS(_Op, _T1, _T2)	\
+  inline bool operator _Op(_T1 __lhs, _T2 __rhs)	\
+  { return __lhs _Op __rhs.__getval(); }
+
+#define _DEFINE_DECIMAL_COMPARISONS(_Op, _Tp)			\
+  _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal32)		\
+  _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal64)		\
+  _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal128)		\
+  _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, int)			\
+  _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned int)	\
+  _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long)		\
+  _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long)	\
+  _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long long)		\
+  _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long long)	\
+  _DEFINE_DECIMAL_COMPARISON_RHS(_Op, int, _Tp)			\
+  _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned int, _Tp)	\
+  _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long, _Tp)		\
+  _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long, _Tp)	\
+  _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long long, _Tp)		\
+  _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long long, _Tp)
+
+  _DEFINE_DECIMAL_COMPARISONS(==, decimal32)
+  _DEFINE_DECIMAL_COMPARISONS(==, decimal64)
+  _DEFINE_DECIMAL_COMPARISONS(==, decimal128)
+  _DEFINE_DECIMAL_COMPARISONS(!=, decimal32)
+  _DEFINE_DECIMAL_COMPARISONS(!=, decimal64)
+  _DEFINE_DECIMAL_COMPARISONS(!=, decimal128)
+  _DEFINE_DECIMAL_COMPARISONS(<,  decimal32)
+  _DEFINE_DECIMAL_COMPARISONS(<,  decimal64)
+  _DEFINE_DECIMAL_COMPARISONS(<,  decimal128)
+  _DEFINE_DECIMAL_COMPARISONS(<=, decimal32)
+  _DEFINE_DECIMAL_COMPARISONS(<=, decimal64)
+  _DEFINE_DECIMAL_COMPARISONS(<=, decimal128)
+  _DEFINE_DECIMAL_COMPARISONS(>,  decimal32)
+  _DEFINE_DECIMAL_COMPARISONS(>,  decimal64)
+  _DEFINE_DECIMAL_COMPARISONS(>,  decimal128)
+  _DEFINE_DECIMAL_COMPARISONS(>=, decimal32)
+  _DEFINE_DECIMAL_COMPARISONS(>=, decimal64)
+  _DEFINE_DECIMAL_COMPARISONS(>=, decimal128)
+
+#undef _DEFINE_DECIMAL_COMPARISON_BOTH
+#undef _DEFINE_DECIMAL_COMPARISON_LHS
+#undef _DEFINE_DECIMAL_COMPARISON_RHS
+#undef _DEFINE_DECIMAL_COMPARISONS
+  _GLIBCXX_END_NAMESPACE_VERSION
+} // namespace decimal
+} // namespace std
+
+#endif /* _GLIBCXX_DECIMAL_IMPL */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/deque b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/deque
new file mode 100644
index 0000000..7b0604b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/deque
@@ -0,0 +1,77 @@
+// <deque> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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>
+#include <bits/range_access.h>
+#include <bits/deque.tcc>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/deque>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/deque>
+#endif
+
+#endif /* _GLIBCXX_DEQUE */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/exception b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/exception
new file mode 100644
index 0000000..db75ad1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/exception
@@ -0,0 +1,158 @@
+// Exception Handling support header for -*- C++ -*-
+
+// Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+// 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file exception
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef __EXCEPTION__
+#define __EXCEPTION__
+
+#pragma GCC system_header
+
+#pragma GCC visibility push(default)
+
+#include <bits/c++config.h>
+
+extern "C++" {
+
+namespace std
+{
+  /**
+   * @defgroup exceptions Exceptions
+   * @ingroup diagnostics
+   *
+   * Classes and functions for reporting errors via exception classes.
+   * @{
+   */
+
+  /**
+   *  @brief Base class for all library exceptions.
+   *
+   *  This is the base class for all exceptions thrown by the standard
+   *  library, and by certain language expressions.  You are free to derive
+   *  your own %exception classes, or use a different hierarchy, or to
+   *  throw non-class data (e.g., fundamental types).
+   */
+  class exception
+  {
+  public:
+    exception() throw() { }
+    virtual ~exception() throw();
+
+    /** Returns a C-style character string describing the general cause
+     *  of the current error.  */
+    virtual const char* what() const throw();
+  };
+
+  /** If an %exception is thrown which is not listed in a function's
+   *  %exception specification, one of these may be thrown.  */
+  class bad_exception : public exception
+  {
+  public:
+    bad_exception() throw() { }
+
+    // This declaration is not useless:
+    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
+    virtual ~bad_exception() throw();
+
+    // See comment in eh_exception.cc.
+    virtual const char* what() const throw();
+  };
+
+  /// If you write a replacement %terminate handler, it must be of this type.
+  typedef void (*terminate_handler) ();
+
+  /// If you write a replacement %unexpected handler, it must be of this type.
+  typedef void (*unexpected_handler) ();
+
+  /// Takes a new handler function as an argument, returns the old function.
+  terminate_handler set_terminate(terminate_handler) throw();
+
+  /** The runtime will call this function if %exception handling must be
+   *  abandoned for any reason.  It can also be called by the user.  */
+  void terminate() throw() __attribute__ ((__noreturn__));
+
+  /// Takes a new handler function as an argument, returns the old function.
+  unexpected_handler set_unexpected(unexpected_handler) throw();
+
+  /** The runtime will call this function if an %exception is thrown which
+   *  violates the function's %exception specification.  */
+  void unexpected() __attribute__ ((__noreturn__));
+
+  /** [18.6.4]/1:  'Returns true after completing evaluation of a
+   *  throw-expression until either completing initialization of the
+   *  exception-declaration in the matching handler or entering @c unexpected()
+   *  due to the throw; or after entering @c terminate() for any reason
+   *  other than an explicit call to @c terminate().  [Note: This includes
+   *  stack unwinding [15.2].  end note]'
+   *
+   *  2: 'When @c uncaught_exception() is true, throwing an
+   *  %exception can result in a call of @c terminate()
+   *  (15.5.1).'
+   */
+  bool uncaught_exception() throw() __attribute__ ((__pure__));
+
+  // @} group exceptions
+} // namespace std
+
+namespace __gnu_cxx
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief A replacement for the standard terminate_handler which
+   *  prints more information about the terminating exception (if any)
+   *  on stderr.
+   *
+   *  @ingroup exceptions
+   *
+   *  Call
+   *   @code
+   *     std::set_terminate(__gnu_cxx::__verbose_terminate_handler)
+   *   @endcode
+   *  to use.  For more info, see
+   *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html
+   *
+   *  In 3.4 and later, this is on by default.
+   */
+  void __verbose_terminate_handler();
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+} // extern "C++"
+
+#pragma GCC visibility pop
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+     && defined(_GLIBCXX_ATOMIC_BUILTINS_4))
+#include <bits/exception_ptr.h>
+#include <bits/nested_exception.h>
+#endif
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/algorithm b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/algorithm
new file mode 100644
index 0000000..417a03a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/algorithm
@@ -0,0 +1,605 @@
+// Algorithm extensions -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 __gnu_cxx::__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
+   *  <em>lexigraphically less than</em> the second, greater than zero
+   *  if the second range is <em>lexigraphically less than</em> 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);
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  using std::is_heap;
+#else
+  /**
+   *  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);
+    }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  using std::is_sorted;
+#else
+  // 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;
+    }
+#endif  // __GXX_EXPERIMENTAL_CXX0X__
+
+  /**
+   *  @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>
+    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>
+    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;
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _EXT_ALGORITHM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/array_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/array_allocator.h
new file mode 100644
index 0000000..9c61d74
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/array_allocator.h
@@ -0,0 +1,157 @@
+// array allocator -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++config.h>
+#include <new>
+#include <bits/functexcept.h>
+#include <tr1/array>
+#include <bits/move.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ 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 std::__addressof(__x); }
+
+      const_pointer
+      address(const_reference __x) const { return std::__addressof(__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 = 0) 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(0), _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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/atomicity.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/atomicity.h
new file mode 100644
index 0000000..f0c7752
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/atomicity.h
@@ -0,0 +1,116 @@
+// Support for atomic operations -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/atomicity.h
+ *  This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_ATOMICITY_H
+#define _GLIBCXX_ATOMICITY_H	1
+
+#include <bits/c++config.h>
+#include <bits/gthr.h>
+#include <bits/atomic_word.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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) throw ();
+
+  void
+  __attribute__ ((__unused__))
+  __atomic_add(volatile _Atomic_word*, int) throw ();
+#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_VERSION
+} // 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/bitmap_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/bitmap_allocator.h
new file mode 100644
index 0000000..4993c2c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/bitmap_allocator.h
@@ -0,0 +1,1112 @@
+// Bitmap Allocator. -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <utility> // For std::pair.
+#include <bits/functexcept.h> // For __throw_bad_alloc().
+#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
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+  using std::size_t;
+  using std::ptrdiff_t;
+
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+    /** @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) { }
+
+	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;
+      }
+
+    /** @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 = __detail::__num_bitmaps(__bp);
+
+	  if (*(reinterpret_cast<size_t*>
+		(__bp.first) - (__diff + 1)) == __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;
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace __detail
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /** @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
+  {
+  public:
+    typedef size_t* 				value_type;
+    typedef __detail::__mini_vector<value_type> vector_type;
+    typedef vector_type::iterator 		iterator;
+    typedef __mutex				__mutex_type;
+
+  private:
+    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 = __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
+      __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;
+      typedef typename _BPVector::iterator _BPiter;
+
+      template<typename _Predicate>
+        static _BPiter
+        _S_find(_Predicate __p)
+        {
+	  _BPiter __first = _S_mem_blocks.begin();
+	  while (__first != _S_mem_blocks.end() && !__p(*__first))
+	    ++__first;
+	  return __first;
+	}
+
+#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 __detail::_Ffit_finder<_Alloc_block*> _FFF;
+	_BPiter __bpi = _S_find(_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);
+
+	for (size_t __i = 0; __i < __num_bitmaps; ++__i)
+	  __temp[__i] = ~static_cast<size_t>(0); // 1 Indicates all Free.
+
+	_S_block_size *= 2;
+      }
+
+      static _BPVector _S_mem_blocks;
+      static size_t _S_block_size;
+      static __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
+	__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 __detail::_Ffit_finder<_Alloc_block*> _FFF;
+	    _FFF __fff;
+	    _BPiter __bpi = _S_find(__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) - (__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)
+	  - (__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
+	__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);
+
+	__detail::_Inclusive_between<_Alloc_block*> __ibt(__real_p);
+	if (__ibt(_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 = _S_find(__ibt);
+
+	    _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)
+	  - (__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 (__n > this->max_size())
+	  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 std::__addressof(__r); }
+
+      const_pointer 
+      address(const_reference __r) const
+      { return std::__addressof(__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 bitmap_allocator<_Tp>::_BPVector::size_type 
+    bitmap_allocator<_Tp>::_S_last_dealloc_index = 0;
+
+  template<typename _Tp>
+    __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_VERSION
+} // namespace __gnu_cxx
+
+#endif 
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/cast.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/cast.h
new file mode 100644
index 0000000..f3384f9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/cast.h
@@ -0,0 +1,121 @@
+// <cast.h> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cast.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/pointer.h}
+ */
+
+#ifndef _GLIBCXX_CAST_H
+#define _GLIBCXX_CAST_H 1
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * 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_VERSION
+} // namespace
+
+#endif // __GLIBCXX_CAST_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/codecvt_specializations.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/codecvt_specializations.h
new file mode 100644
index 0000000..38b95ef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/codecvt_specializations.h
@@ -0,0 +1,514 @@
+// Locale support (codecvt) -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// 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_VERSION
+} // namespace
+
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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, 0, 0,
+                                          &__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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/concurrence.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/concurrence.h
new file mode 100644
index 0000000..fc8f63f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/concurrence.h
@@ -0,0 +1,389 @@
+// Support for concurrent programing -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/concurrence.h
+ *  This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _CONCURRENCE_H
+#define _CONCURRENCE_H 1
+
+#pragma GCC system_header
+
+#include <exception>
+#include <bits/gthr.h> 
+#include <bits/functexcept.h>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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 
+    }
+
+#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT
+    ~__mutex() 
+    { 
+      if (__gthread_active_p())
+	__gthread_mutex_destroy(&_M_mutex); 
+    }
+#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 
+    }
+
+#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
+    ~__recursive_mutex()
+    {
+      if (__gthread_active_p())
+	_S_destroy(&_M_mutex);
+    }
+#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; }
+
+#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
+    // FIXME: gthreads doesn't define __gthread_recursive_mutex_destroy
+    // so we need to obtain a __gthread_mutex_t to destroy
+  private:
+    template<typename _Mx, typename _Rm>
+      static void
+      _S_destroy_win32(_Mx* __mx, _Rm const* __rmx)
+      {
+        __mx->counter = __rmx->counter;
+        __mx->sema = __rmx->sema;
+        __gthread_mutex_destroy(__mx);
+      }
+
+    // matches a gthr-win32.h recursive mutex
+    template<typename _Rm>
+      static typename __enable_if<sizeof(&_Rm::sema), void>::__type
+      _S_destroy(_Rm* __mx)
+      {
+        __gthread_mutex_t __tmp;
+        _S_destroy_win32(&__tmp, __mx);
+      }
+
+    // matches a recursive mutex with a member 'actual'
+    template<typename _Rm>
+      static typename __enable_if<sizeof(&_Rm::actual), void>::__type
+      _S_destroy(_Rm* __mx)
+      { __gthread_mutex_destroy(&__mx->actual); }
+
+    // matches when there's only one mutex type
+    template<typename _Rm>
+      static typename
+      __enable_if<std::__are_same<_Rm, __gthread_mutex_t>::__value,
+        void>::__type
+      _S_destroy(_Rm* __mx)
+      { __gthread_mutex_destroy(__mx); }
+#endif
+  };
+
+  /// 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 
+    }
+
+#if __GTHREADS && ! defined __GTHREAD_COND_INIT
+    ~__cond() 
+    { 
+      if (__gthread_active_p())
+	__gthread_cond_destroy(&_M_cond); 
+    }
+#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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/debug_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/debug_allocator.h
new file mode 100644
index 0000000..12a5ea6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/debug_allocator.h
@@ -0,0 +1,127 @@
+// Allocators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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.
+ */
+
+#ifndef _DEBUG_ALLOCATOR_H
+#define _DEBUG_ALLOCATOR_H 1
+
+#include <stdexcept>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/enc_filebuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/enc_filebuf.h
new file mode 100644
index 0000000..058d330
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/enc_filebuf.h
@@ -0,0 +1,65 @@
+// 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/extptr_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/extptr_allocator.h
new file mode 100644
index 0000000..dfb76ac
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/extptr_allocator.h
@@ -0,0 +1,181 @@
+// <extptr_allocator.h> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+ *  This file is a GNU extension to the Standard C++ Library.
+ *
+ *  @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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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 std::__addressof(__x); }
+
+      const_pointer address(const_reference __x) const
+      { return std::__addressof(__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_VERSION
+} // namespace
+
+#endif /* _EXTPTR_ALLOCATOR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/functional b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/functional
new file mode 100644
index 0000000..7e8acdf
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/functional
@@ -0,0 +1,427 @@
+// Functional extensions -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 @a 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 @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_VERSION
+} // namespace
+
+#endif
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_map
new file mode 100644
index 0000000..24c439e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_map
@@ -0,0 +1,600 @@
+// Hashing map implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 _BACKWARD_HASH_MAP
+#define _BACKWARD_HASH_MAP 1
+
+#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
+#include "backward_warning.h"
+#endif
+
+#include <bits/c++config.h>
+#include <backward/hashtable.h>
+#include <bits/concept_check.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_set
new file mode 100644
index 0000000..f110fec
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_set
@@ -0,0 +1,568 @@
+// Hashing set implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 _BACKWARD_HASH_SET
+#define _BACKWARD_HASH_SET 1
+
+#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
+#include "backward_warning.h"
+#endif
+
+#include <bits/c++config.h>
+#include <backward/hashtable.h>
+#include <bits/concept_check.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/iterator b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/iterator
new file mode 100644
index 0000000..3e8f438
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/iterator
@@ -0,0 +1,116 @@
+// 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/malloc_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/malloc_allocator.h
new file mode 100644
index 0000000..3aa994d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/malloc_allocator.h
@@ -0,0 +1,137 @@
+// Allocator that wraps "C" malloc -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 std::__addressof(__x); }
+
+      const_pointer
+      address(const_reference __x) const { return std::__addressof(__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 (__n > this->max_size())
+	  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/memory b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/memory
new file mode 100644
index 0000000..ddcfe22
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/memory
@@ -0,0 +1,198 @@
+// 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 __gnu_cxx::__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 __gnu_cxx::__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 __gnu_cxx::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_VERSION
+} // namespace
+
+#endif
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/mt_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/mt_allocator.h
new file mode 100644
index 0000000..91eac24
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/mt_allocator.h
@@ -0,0 +1,754 @@
+// MT-optimized allocator -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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(0), _M_init(false) { }
+
+    explicit 
+    __pool_base(const _Tune& __options)
+    : _M_options(__options), _M_binmap(0), _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) throw ();
+    
+      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(0), _M_bin_size(1) { }
+
+      explicit __pool(const __pool_base::_Tune& __tune) 
+      : __pool_base(__tune), _M_bin(0), _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) throw ();
+    
+      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
+      _GLIBCXX_CONST void 
+      _M_destroy_thread_key(void*) throw ();
+
+      size_t 
+      _M_get_thread_id();
+
+      explicit __pool() 
+      : _M_bin(0), _M_bin_size(1), _M_thread_freelist(0) 
+      { }
+
+      explicit __pool(const __pool_base::_Tune& __tune) 
+      : __pool_base(__tune), _M_bin(0), _M_bin_size(1), 
+	_M_thread_freelist(0) 
+      { }
+
+    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 std::__addressof(__x); }
+
+      const_pointer
+      address(const_reference __x) const
+      { return std::__addressof(__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 @a global one. Steps are taken to limit
+   *  the per thread freelist sizes (by returning excess back to
+   *  the @a 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 (__n > this->max_size())
+	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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/new_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/new_allocator.h
new file mode 100644
index 0000000..35d5cdc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/new_allocator.h
@@ -0,0 +1,134 @@
+// Allocator that wraps operator new -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++config.h>
+#include <new>
+#include <bits/functexcept.h>
+#include <bits/move.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 std::__addressof(__x); }
+
+      const_pointer
+      address(const_reference __x) const { return std::__addressof(__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 (__n > this->max_size())
+	  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric
new file mode 100644
index 0000000..b389177
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric
@@ -0,0 +1,152 @@
+// 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
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  using std::iota;
+#else
+  /**
+   *  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++;
+    }
+#endif  // __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric_traits.h
new file mode 100644
index 0000000..e84e298
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric_traits.h
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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__) * 643L / 2136)
+
+#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_VERSION
+} // namespace
+
+#undef __glibcxx_floating
+#undef __glibcxx_max_digits10
+#undef __glibcxx_digits10
+#undef __glibcxx_max_exponent10
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/assoc_container.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/assoc_container.hpp
new file mode 100644
index 0000000..9cec3b7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/assoc_container.hpp
@@ -0,0 +1,700 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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
+{
+  /** @defgroup pbds Policy-Based Data Structures
+   *  @ingroup extensions
+   *
+   *  This is a library of policy-based elementary data structures:
+   *  associative containers and priority queues. It is designed for
+   *  high-performance, flexibility, semantic safety, and conformance
+   *  to the corresponding containers in std (except for some points
+   *  where it differs by design).
+   *
+   *  For details, see: 
+   *  http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html
+   *
+   *  @{
+   */
+ 
+#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
+
+  // @} group pbds
+} // namespace __gnu_pbds
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
new file mode 100644
index 0000000..e600f2c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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_0_NODE_METADATA_HPP
+#define PB_DS_0_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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_types.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_types.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
new file mode 100644
index 0000000..ec83692
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
@@ -0,0 +1,497 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 @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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 0000000..1aa2fd4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,219 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+	  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 = 0;
+  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 == 0)
+    return (0);
+
+  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 = 0;
+
+  __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 != 0)
+    p_ret->m_p_left->m_p_parent = p_ret;
+
+  if (p_ret->m_p_right != 0)
+    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 == 0)
+    {
+      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 != 0)
+      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 != 0)
+      p_max = p_max->m_p_right;
+    m_p_head->m_p_right = p_max;
+  }
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
new file mode 100644
index 0000000..2d3001a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
@@ -0,0 +1,272 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    {
+      _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 != 0);
+  if (m_p_head->m_p_parent == 0)
+    {
+      _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 != 0)
+    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 == 0)
+    return (std::make_pair((const_pointer)0,(const_pointer)0));
+
+  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 != 0)
+    _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 != 0)
+    _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 != 0)? l_range.first :& p_nd->m_value,(r_range.second != 0)? 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 == 0)
+    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 == 0)
+    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 == 0)
+    {
+      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);
+      return;
+    }
+
+  if (p_nd->m_p_left == 0)
+    {
+      _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 == 0)
+    {
+      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);
+      return;
+    }
+
+  if (p_nd->m_p_right == 0)
+    {
+      _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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
new file mode 100644
index 0000000..86a663e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
new file mode 100644
index 0000000..082c7f0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
@@ -0,0 +1,182 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    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 != 0)
+    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 != 0)
+    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 != 0)
+    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 != 0)
+    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 != 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
new file mode 100644
index 0000000..0c25ad2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
@@ -0,0 +1,211 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    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 == 0)
+    return (std::make_pair(
+			   insert_leaf_new(r_value, p_pot, true),
+			   true));
+
+  while (p_nd->m_p_right != 0)
+    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 == 0);
+      _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 == 0);
+      _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 = 0;
+
+  _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 = 0;
+
+  _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 = 0;
+
+  ++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 = 0;
+
+  ++m_size;
+
+  return (p_new_nd);
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
new file mode 100644
index 0000000..e5f6a4d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_end()
+{
+  return (node_iterator(0));
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
new file mode 100644
index 0000000..b4ea453
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
@@ -0,0 +1,237 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0) : 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 = 0) : 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
new file mode 100644
index 0000000..959df68
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
@@ -0,0 +1,381 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0) 
+      : 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 != 0);
+	return &m_p_nd->m_value;
+      }
+
+      inline const_reference
+      operator*() const
+      {
+	_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
+	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 != 0);
+	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 != 0)
+	  {
+	    m_p_nd = m_p_nd->m_p_right;
+	    while (m_p_nd->m_p_left != 0)
+	      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 != 0)
+	  {
+	    Node_Pointer p_y = m_p_nd->m_p_left;
+	    while (p_y->m_p_right != 0)
+	      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 = 0) 
+      : 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 != 0);
+	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 != 0);
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
new file mode 100644
index 0000000..3bdd1eb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
new file mode 100644
index 0000000..6989ca6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
@@ -0,0 +1,156 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    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 != 0)
+    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>(0)));
+}
+
+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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..11dc308
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    return 0;
+  return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
new file mode 100644
index 0000000..aa86f5e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+	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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
new file mode 100644
index 0000000..3d75e86
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0) { }
+
+      // 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 != 0);
+	return to_ptr(integral_constant<int, Simple>());
+      }
+
+      // Access.
+      inline const_reference
+      operator*() const
+      {
+	_GLIBCXX_DEBUG_ASSERT(m_p_e != 0);
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
new file mode 100644
index 0000000..a842651
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
@@ -0,0 +1,242 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..a297442
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+  entry_pointer a_other_entries = 0;
+
+  __try
+    {
+      a_entries = s_entry_allocator.allocate(actual_size);
+
+      a_other_entries = s_entry_allocator.allocate(other_actual_size);
+    }
+  __catch(...)
+    {
+      if (a_entries != 0)
+	s_entry_allocator.deallocate(a_entries, actual_size);
+
+      if (a_other_entries != 0)
+	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 = 0;
+  entry_pointer a_other_entries = 0;
+
+  __try
+    {
+      a_entries = s_entry_allocator.allocate(actual_size);
+      a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
+    }
+  __catch(...)
+    {
+      if (a_entries != 0)
+	s_entry_allocator.deallocate(a_entries, actual_size);
+
+      if (a_other_entries != 0)
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 0000000..08cc437
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+{
+  _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(0)
+{
+  _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(0)
+{
+  _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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
new file mode 100644
index 0000000..6cf01e0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    return;
+  _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == 0);
+  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 == 0)
+    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 != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
new file mode 100644
index 0000000..df0ea6b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    find_max();
+
+  _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
+
+  node_pointer p_nd = m_p_max;
+
+  remove_parentless_node(m_p_max);
+
+  base_type::actual_erase_node(p_nd);
+
+  m_p_max = 0;
+
+  _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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == 0);
+
+  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 != 0)
+    p_cur_root->m_p_prev_or_parent = 0;
+
+  if (p_nd->m_p_prev_or_parent != 0)
+    p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
+
+  if (p_nd->m_p_next_sibling != 0)
+    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 != 0)
+    {
+      p_child->m_p_prev_or_parent = 0;
+
+      while (p_child->m_p_next_sibling != 0)
+	p_child = p_child->m_p_next_sibling;
+    }
+
+  m_p_max = 0;
+
+  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 = 0;
+}
+
+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 = 0;
+
+  _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 != 0)
+    {
+      ++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 = 0;
+
+  while (p_cur != 0)
+    {
+      node_pointer p_next = p_cur->m_p_next_sibling;
+
+      p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
+
+      p_cur->m_metadata = 0;
+
+      p_cur->m_p_next_sibling = base_type::m_p_root;
+
+      if (base_type::m_p_root != 0)
+	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 = 0;
+
+  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+    return ersd;
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
new file mode 100644
index 0000000..48409d8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max();
+
+  _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
+  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 != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
new file mode 100644
index 0000000..1ccaddf
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
@@ -0,0 +1,216 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+
+  _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 == 0)
+    {
+      p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent =
+	p_nd->m_p_l_child = 0;
+
+      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 = 0;
+
+      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 = 0;
+
+      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 = 0;
+
+      base_type::m_p_root = p_nd;
+    }
+  else
+    {
+      p_nd->m_p_next_sibling = 0;
+
+      p_nd->m_p_l_child = 0;
+
+      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 != 0&& 
+	 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 != 0)
+	    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 != 0)
+	    p_next->m_p_next_sibling = 0;
+
+	  base_type::make_child_of(p_next, p_nd);
+
+	  ++p_nd->m_metadata;
+        }
+    }
+
+  if (p_nd->m_p_next_sibling != 0)
+    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 != 0);
+  _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 != 0&& 
+	     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 == 0)
+	base_type::m_p_root = p_nd;
+
+      m_p_max = 0;
+
+      _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 = 0;
+
+  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+    }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..9f7e36e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
@@ -0,0 +1,232 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      _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 = 0;
+
+      p_out->m_metadata = 0;
+
+      p_out->m_p_next_sibling = other.m_p_root;
+
+      if (other.m_p_root != 0)
+	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 = 0;
+
+  while (p_cur != 0)
+    {
+      node_pointer p_next = p_cur->m_p_next_sibling;
+
+      p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
+
+      p_cur->m_metadata = 0;
+
+      p_cur->m_p_next_sibling = base_type::m_p_root;
+
+      if (base_type::m_p_root != 0)
+	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 = 0;
+
+  _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 != 0)
+    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 != 0);
+
+  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 = 0;
+
+  other.m_p_root = 0;
+  other.m_size = 0;
+  other.m_p_max = 0;
+
+  _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 = 0;
+
+  node_pointer p_cur = 0;
+
+  while (p_lhs != 0 || p_rhs != 0)
+    {
+      if (p_rhs == 0)
+        {
+	  if (p_cur == 0)
+	    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 = 0;
+        }
+      else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata)
+        {
+	  if (p_cur == 0)
+            {
+	      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 == 0)
+	    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 != 0)
+    p_cur->m_p_next_sibling = 0;
+
+  if (p_ret != 0)
+    p_ret->m_p_prev_or_parent = 0;
+
+  return p_ret;
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
new file mode 100644
index 0000000..4529a15
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
@@ -0,0 +1,636 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0 
+	       && !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 != 0)
+	  {
+	    _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 != 0 && 
+	       !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 != 0)
+	  {
+	    _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 != 0 && 
+	       !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 == 0)
+	  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 != 0 && 
+	       !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 == 0)
+	  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 != 0);
+	r_pos.first = r_pos.first->m_p_next;
+	if (r_pos.first != 0)
+	  {
+	    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] != 0)
+	    {
+	      r_pos.first = m_entries[r_pos.second];
+	      r_p_value = &r_pos.first->m_value;
+	      return;
+	    }
+	r_p_value = 0;
+      }
+
+      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] != 0)
+	    {
+	      r_pos.first = m_entries[r_pos.second];
+	      r_p_value = &r_pos.first->m_value;
+	      return;
+	    }
+	r_p_value = 0;
+      }
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
new file mode 100644
index 0000000..c61eff9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
new file mode 100644
index 0000000..88a5680
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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)0);
+  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(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(0));
+  Resize_Policy::notify_resized(m_num_e);
+  Resize_Policy::notify_cleared();
+  ranged_hash_fn_base::notify_resized(m_num_e);
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
new file mode 100644
index 0000000..b42ed7a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+        {
+	  ++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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
new file mode 100644
index 0000000..0799911
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
new file mode 100644
index 0000000..c6febe4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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] != 0 && 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 != 0 && p_e->m_p_next != 0)
+        {
+	  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] != 0)
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
new file mode 100644
index 0000000..4f513e9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/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, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    {
+      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 == 0)
+        {
+	  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
new file mode 100644
index 0000000..6e21ace
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/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, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    {
+      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 == 0)
+        {
+	  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
new file mode 100644
index 0000000..f884941
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 0; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find_end() const
+{ return 0; }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
new file mode 100644
index 0000000..2b42996
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
new file mode 100644
index 0000000..1de42e8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/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, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0 && !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 != 0)
+    {
+      _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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
new file mode 100644
index 0000000..c7b0bdc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/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, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0 && !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 != 0)
+    {
+      _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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
new file mode 100644
index 0000000..3db838b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
@@ -0,0 +1,134 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0));
+
+  for (size_type pos = 0; pos < old_size; ++pos)
+    {
+      entry_pointer p_e = m_entries[pos];
+      while (p_e != 0)
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
new file mode 100644
index 0000000..497977d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      std::cerr << PB_DS_V2F(p_l->m_value) << " ";
+      p_l = p_l->m_p_next;
+    }
+}
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cond_dealtor.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cond_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/container_base_dispatch.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/container_base_dispatch.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/debug_map_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/debug_map_base.hpp
new file mode 100644
index 0000000..9dc7635
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/debug_map_base.hpp
@@ -0,0 +1,346 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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;
+      typedef std::_GLIBCXX_STD_C::list<Key> 		key_set;
+      typedef typename key_set::iterator 		key_set_iterator;
+      typedef typename key_set::const_iterator 		const_key_set_iterator;
+      typedef __gnu_cxx::throw_allocator_random<Key>	key_db_allocator;
+      typedef typename key_db_allocator::never_adjustor	never_adjustor;
+
+    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:
+      void
+      assert_valid() const;
+
+      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();)
+
+      if (find(r_key) != m_key_set.end())
+	{
+	  std::cerr << "insert_new key already present " << r_key << std::endl;
+	  std::abort;
+	}
+
+      never_adjustor never;
+      __try
+	{
+	  m_key_set.push_back(r_key);
+	}
+      __catch(...)
+	{
+	  std::cerr << "insert_new " << r_key << std::endl;
+	  std::abort();
+	}
+
+      _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();)
+     }
+
+    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;
+	}
+    }
+
+    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)
+    {
+      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;
+    }
+
+    PB_DS_CLASS_T_DEC
+    void
+    PB_DS_CLASS_C_DEC::
+    join(PB_DS_CLASS_C_DEC& other)
+    {
+      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());
+    }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
new file mode 100644
index 0000000..dbd0569
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 0; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find_end() const
+{ return 0; }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
new file mode 100644
index 0000000..3e69b2e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
@@ -0,0 +1,677 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 0;
+		}
+		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 0;
+      }
+
+      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 0;
+		}
+		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 0;
+      }
+
+      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 != 0);
+	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 = 0;
+      }
+
+      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 = 0;
+      }
+
+      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 = 0;
+      }
+
+#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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
new file mode 100644
index 0000000..e1b837a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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_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 = 0;
+
+  // 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
new file mode 100644
index 0000000..dac0639
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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<std::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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
new file mode 100644
index 0000000..7dcd825
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
new file mode 100644
index 0000000..988f111
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
new file mode 100644
index 0000000..8fa04d1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
new file mode 100644
index 0000000..2bcfdf5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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, std::size_t hash, size_type i) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
new file mode 100644
index 0000000..2448f3c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+	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 != 0)
+	  {
+	    base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;
+	    while (base_type::m_p_nd->m_p_l_child != 0)
+	      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 == 0 || 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
new file mode 100644
index 0000000..712a76f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+      { }
+
+      // 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 != 0);
+	return &m_p_nd->m_value;
+      }
+
+      // Access.
+      inline const_reference
+      operator*() const
+      {
+	_GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
+	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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 0000000..5b6ada3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,153 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0),
+  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(0),
+  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(0), 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 == 0)
+    return (0);
+
+  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 = 0;
+
+  __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 != 0)
+    p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;
+
+  if (p_ret->m_p_next_sibling != 0)
+    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 : 0;
+
+  return p_ret;
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
new file mode 100644
index 0000000..0408d14
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 || m_p_root->m_p_prev_or_parent == 0);
+
+  if (m_p_root != 0)
+    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 == 0)
+    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 == 0);
+  else if (p_nd->m_p_next_sibling != 0)
+    _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);
+
+  if (p_nd->m_p_l_child == 0)
+    return;
+
+  const_node_pointer p_child = p_nd->m_p_l_child;
+  while (p_child != 0)
+    {
+      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 != 0)
+    {
+      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 != 0)
+    {
+      ++ret;
+      p_child = p_child->m_p_next_sibling;
+    }
+  return ret;
+}
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
new file mode 100644
index 0000000..2d8ab2d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+}
+
+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 != 0)
+    {
+      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 != 0)
+    if (p_cur->m_p_l_child != 0)
+      {
+	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 != 0)
+    {
+      ++count;
+      _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == 0);
+      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 = 0;
+  node_pointer p_out = 0;
+  while (p_cur != 0)
+    {
+      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 != 0)
+	    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 != 0)
+	    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 != 0)
+    {
+      swap_with_parent(p_nd, p_parent);
+      p_parent = parent(p_nd);
+    }
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
new file mode 100644
index 0000000..9ffc912
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
@@ -0,0 +1,175 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_new_parent != 0);
+
+  p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;
+
+  if (p_new_parent->m_p_l_child != 0)
+    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 == 0 || 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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_parent != 0);
+  _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 == 0;
+  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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != 0);
+
+  if (p_nd->m_p_next_sibling != 0)
+    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
+
+  if (p_parent->m_p_next_sibling != 0)
+    p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;
+
+  if (p_parent->m_p_l_child != 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
new file mode 100644
index 0000000..ec09cf6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    return (iterator(0));
+
+  while (p_nd->m_p_l_child != 0)
+    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 == 0)
+    return (const_iterator(0));
+
+  while (p_nd->m_p_l_child != 0)
+    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(0));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{
+  return (const_iterator(0));
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
new file mode 100644
index 0000000..5f04e14
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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_0_METADATA_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_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_0_METADATA_HPP
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
new file mode 100644
index 0000000..d421002
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
new file mode 100644
index 0000000..0564885
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+{ _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(0)
+{
+  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(0)
+{
+  __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 != 0)
+    {
+      entry_pointer p_next_l = p_l->m_p_next;
+      actual_erase_entry(p_l);
+      p_l = p_next_l;
+    }
+  m_p_l = 0;
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_CLASS_NAME()
+{ deallocate_all(); }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
new file mode 100644
index 0000000..c481aaa
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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 != 0)
+    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 != 0 && 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 == 0)
+    return num_ersd;
+
+  entry_pointer p_l = m_p_l;
+  while (p_l->m_p_next != 0)
+    {
+      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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_l != m_p_l);
+  _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != 0);
+  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
new file mode 100644
index 0000000..0c872cb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    return 0;
+  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 != 0)
+    {
+      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 0;
+}
+
+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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
new file mode 100644
index 0000000..31f743c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0); }
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
new file mode 100644
index 0000000..3e294fb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      _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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
new file mode 100644
index 0000000..ac31638
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    {
+      _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 == 0)
+    {
+      _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(0, 0, 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(0, 0, const_cast<PB_DS_CLASS_C_DEC* const>(this));
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
new file mode 100644
index 0000000..aa8dd1b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
@@ -0,0 +1,359 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 ? 0: &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 == 0 ? 0: &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 == 0) ? 0 : &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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
new file mode 100644
index 0000000..0096109
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
new file mode 100644
index 0000000..8e476cb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = std::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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 0000000..d6844fc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,273 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0),
+  m_a_metadata(0),
+  m_end_it(0),
+  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(0),
+  m_a_metadata(0),
+  m_end_it(0),
+  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(0),
+  m_a_metadata(0),
+  m_end_it(0),
+  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(0),
+  m_a_metadata(0),
+  m_end_it(0),
+  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
new file mode 100644
index 0000000..66f4ed6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 || m_end_it == 0 || m_size == 0)
+    _GLIBCXX_DEBUG_ASSERT(m_a_values == 0 &&  m_end_it == 0 && 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
new file mode 100644
index 0000000..6f9a09d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
@@ -0,0 +1,193 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+  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_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_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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
new file mode 100644
index 0000000..51d1b4d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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) ? 0 : s_metadata_alloc.allocate(new_size);
+
+  if (m_a_metadata != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
new file mode 100644
index 0000000..40f1100
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)?
+			      0 :
+			      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 == 0) ? 0 : 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 == 0) ? 0 : 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 == 0) ? 0 : m_a_metadata + m_size);
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
new file mode 100644
index 0000000..3517896
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
@@ -0,0 +1,292 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0,  const_pointer p_begin_nd = 0,  const_pointer p_end_nd = 0,  const_metadata_pointer p_metadata = 0) : 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 != 0);
+	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 == 0) ?
+			  0 : 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 = 0,  const_pointer p_begin_nd = 0,  const_pointer p_end_nd = 0,  const_metadata_pointer p_metadata = 0) : 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 == 0)?
+			  0 : 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
new file mode 100644
index 0000000..7d2ed3f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/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_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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
new file mode 100644
index 0000000..f6a1e94
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 
+		        || base_type::m_p_root->m_p_next_sibling == 0);
+  base_type::assert_valid();
+}
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
new file mode 100644
index 0000000..7ab3193
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
@@ -0,0 +1,236 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    p_new_root->m_p_prev_or_parent = 0;
+
+  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 != 0)
+    base_type::assert_node_consistent(p_new_child, false);
+#endif 
+
+  if (p_nd == base_type::m_p_root)
+    {
+      if (p_new_child != 0)
+	p_new_child->m_p_prev_or_parent = 0;
+      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 != 0);
+  if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd)
+    {
+      if (p_new_child != 0)
+        {
+	  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 != 0)
+	    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 != 0)
+	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 != 0)
+    {
+      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 != 0)
+	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 != 0)
+    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 != 0);
+  node_pointer p_ret = p_nd->m_p_l_child;
+  if (p_ret == 0)
+    return 0;
+  while (p_ret->m_p_next_sibling != 0)
+    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 != 0);
+  _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 == 0 
+	? p_next : p_next->m_p_next_sibling;
+    }
+
+  if (p_next->m_p_next_sibling != 0)
+    {
+      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 = 0;
+  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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0);
+
+  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 = 0;
+  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 != 0)
+    {
+      ++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 = 0;
+  while (p_cur != 0)
+    {
+      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 = 0;
+
+      push_imp(p_cur);
+      p_cur = p_next;
+    }
+  _GLIBCXX_DEBUG_ONLY(assert_valid();)
+  return ersd;
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
new file mode 100644
index 0000000..9a5f5f6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+
+  if (base_type::m_p_root == 0)
+    {
+      p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
+
+      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 = 0;
+
+      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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..1e6138c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      _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 = 0;
+
+      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 = 0;
+
+  while (p_cur != 0)
+    {
+      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 = 0;
+
+      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 == 0)
+      {
+        _GLIBCXX_DEBUG_ONLY(assert_valid();)
+	  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+	  return;
+      }
+
+  if (base_type::m_p_root == 0)
+    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 = 0;
+  other.m_size = 0;
+
+  _GLIBCXX_DEBUG_ONLY(assert_valid();)
+    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+    }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
new file mode 100644
index 0000000..b7cdf23
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0,  
+	   node_pointer_pointer p_p_end = 0) 
+  : 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
new file mode 100644
index 0000000..730148e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0,  
+		 node_pointer_pointer p_p_end = 0) 
+  : 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 == 0);
+    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 != 0); }
+#endif 
+
+public:
+  node_pointer_pointer m_p_p_cur;
+  node_pointer_pointer m_p_p_end;
+};
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 0000000..17f7c55
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,215 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+      {
+	_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 = 0;
+  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 != 0);
+  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
new file mode 100644
index 0000000..514da0a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    m_p_head->m_p_parent->assert_valid(this);
+  assert_iterators();
+  assert_reverse_iterators();
+  if (m_p_head->m_p_parent == 0)
+    {
+      _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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
new file mode 100644
index 0000000..8c3c8b9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
@@ -0,0 +1,319 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 || 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
new file mode 100644
index 0000000..ebc3bf2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
@@ -0,0 +1,269 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 || 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 == 0 || 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 (0);
+
+  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 != 0);
+
+  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 == 0)
+	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 != 0);
+
+  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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/head.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/head.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
new file mode 100644
index 0000000..84787f8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
@@ -0,0 +1,465 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+	    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 != 0)
+	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 != 0)
+	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 != 0);
+  if (p_l == 0)
+    {
+      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 != 0);
+  if (p_l == 0)
+    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 != 0);
+  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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_r != 0);
+
+#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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_r != 0);
+
+#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 != 0 && 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
new file mode 100644
index 0000000..56cf133
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
@@ -0,0 +1,599 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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<std::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>(0));
+    }
+
+    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] != 0);
+      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] != 0)
+	return m_a_p_children[i];
+
+      while (++i < arr_size)
+	if (m_a_p_children[i] != 0)
+	  {
+	    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] == 0)
+	{
+	  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] = 0;
+	    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 = 0;
+      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] == 0; ++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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
new file mode 100644
index 0000000..85199f8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0, 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(0, this); }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
new file mode 100644
index 0000000..c574628
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
@@ -0,0 +1,338 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0,  
+			      const_e_access_traits_pointer p_traits = 0) 
+      : 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 = 0,  const_e_access_traits_pointer p_traits = 0) : 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
new file mode 100644
index 0000000..01e9e32
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
@@ -0,0 +1,515 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
new file mode 100644
index 0000000..a3e1506
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
@@ -0,0 +1,484 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0) : 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) == 0)
+	  {
+	    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) == 0)
+	  {
+	    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())? 0 :* 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 (0);
+	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 (0);
+      }
+
+      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 = 0) : 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
new file mode 100644
index 0000000..7b2ebd5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
new file mode 100644
index 0000000..c7fcdb7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    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 != 0)
+    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 == 0) ?
+			0 :
+			& PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == 0) ?
+			0 :
+			& 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
new file mode 100644
index 0000000..c9738d9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
@@ -0,0 +1,254 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    {
+      _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 (0);
+    }
+
+  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 (0);
+    }
+
+  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 (0);
+    }
+
+  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 == 0);
+      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 != 0)
+    m_p_head->m_p_parent->assert_valid(this);
+#endif 
+
+  const size_type total_num_children =((m_p_head->m_p_parent == 0)? 0 : 1) + num_children;
+
+  if (total_num_children == 0)
+    {
+      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
+      return;
+    }
+
+  if (total_num_children == 1)
+    {
+      if (m_p_head->m_p_parent != 0)
+        {
+	  _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)
+          return;
+        }
+
+      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
+      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 != 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
new file mode 100644
index 0000000..39cf28a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
new file mode 100644
index 0000000..8c0304f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0, this));
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
new file mode 100644
index 0000000..ca13ef8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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 != 0)
+    {
+      _GLIBCXX_DEBUG_ASSERT(!p_head->m_p_parent->m_red);
+      assert_node_consistent(p_head->m_p_parent);
+    }
+}
+
+#endif 
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
new file mode 100644
index 0000000..e097bc4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
@@ -0,0 +1,289 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+  node_pointer p_new_x_parent = 0;
+
+  if (p_y->m_p_left == 0)
+    p_x = p_y->m_p_right;
+  else if (p_y->m_p_right == 0)
+    p_x = p_y->m_p_left;
+  else
+    {
+      p_y = p_y->m_p_right;
+      while (p_y->m_p_left != 0)
+	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 != 0)
+	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 = 0;
+	  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 != 0)
+	    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 == 0 || 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 != 0)
+		  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 != 0)
+	      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 != 0)
+		  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 != 0)
+	      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 != 0)
+    p_x->m_red = false;
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
new file mode 100644
index 0000000..0bf6973
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0 || !p_nd->m_red); }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
new file mode 100644
index 0000000..632deab
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0 && 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 != 0 && 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
new file mode 100644
index 0000000..1d84a8e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
@@ -0,0 +1,280 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 @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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..e3cd399
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
@@ -0,0 +1,313 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+  if (p_r != 0)
+    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 != 0)
+	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 != 0)
+    p_x_l->m_p_parent = p_x;
+
+  p_x->m_p_right = p_x_r;
+  if (p_x_r != 0)
+    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 == 0)
+    return (std::make_pair((node_pointer)0, 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 == 0 || 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 == 0)
+    return (std::make_pair((node_pointer)0,
+			   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 == 0 || 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 != 0)
+    {
+      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 != 0);
+
+  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 != 0)
+        {
+	  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 != 0)
+	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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
new file mode 100644
index 0000000..1f6246f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+      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) == 0);
+      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 != 0)
+    {
+      _GLIBCXX_DEBUG_ASSERT(*it == p_nd);
+      const_node_pointer p_next = p_nd->m_p_next_sibling;
+      _GLIBCXX_DEBUG_ASSERT(p_next != 0);
+      _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_next->m_metadata);
+      _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == 0 ||
+		       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 == 0)
+    return 0;
+
+  node_pointer p_next = p_nd->m_p_next_sibling;
+
+  if (p_next == 0)
+    return 0;
+
+  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 == 0)
+    return 0;
+
+  node_pointer p_next = p_nd->m_p_next_sibling;
+
+  if (p_next == 0)
+    return 0;
+
+  if (p_nd->m_metadata < p_next->m_metadata)
+    return p_next;
+
+  return next_after_0_pointer(p_next);
+}
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
new file mode 100644
index 0000000..29d240b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      node_pointer p_next = p_nd->m_p_next_sibling;
+      if (p_next == 0)
+	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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
new file mode 100644
index 0000000..56d189d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+  p_nd->m_metadata = 0;
+
+  if (base_type::m_p_max == 0 || 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 != 0)
+    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 != 0&&  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 != 0);
+  _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 == 0)
+	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 != 0)
+    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 != 0);
+  _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 != 0&&  p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)
+    m_rc.push(p_res);
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
new file mode 100644
index 0000000..1418bbe
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
@@ -0,0 +1,283 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 "  << std::endl
+	    << "1 " << new_size << std::endl
+	    << "2 " << m_load_min << std::endl
+	    << "3 " << m_load_max << std::endl
+	    << "4 " << m_next_shrink_size << std::endl
+	    << "5 " << 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);
+
+#ifdef PB_DS_HT_MAP_RESIZE_TRACE_
+  std::cerr << "hlcrt::notify_externally_resized "  << std::endl
+	    << "1 " << new_size << std::endl
+	    << "2 " << m_load_min << std::endl
+	    << "3 " << m_load_max << std::endl
+	    << "4 " << m_next_shrink_size << std::endl
+	    << "5 " << m_next_grow_size << std::endl
+	    << "6 " << new_shrink_size << std::endl
+	    << "7 " << new_grow_size << std::endl;
+#endif
+
+  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;
+    }
+  else
+    {
+      _GLIBCXX_DEBUG_ASSERT(new_shrink_size <= m_next_shrink_size);
+      m_next_shrink_size = new_shrink_size;
+    }
+
+  _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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
new file mode 100644
index 0000000..c816cfd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
@@ -0,0 +1,161 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
new file mode 100644
index 0000000..33aecdf
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
new file mode 100644
index 0000000..963c553
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
new file mode 100644
index 0000000..9b3ba03
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
new file mode 100644
index 0000000..385623f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 == 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
new file mode 100644
index 0000000..adfabb9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+  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 == 0)
+    {
+      base_type::m_p_head->m_p_parent = p_l;
+      if (p_l != 0)
+	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 != 0);
+  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 = 0);
+  _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 != 0)
+    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 != 0);
+  while (p_nd->m_p_left != 0)
+    p_nd = p_nd->m_p_left;
+  return p_nd;
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
new file mode 100644
index 0000000..9447011
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    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 != 0)
+    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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
new file mode 100644
index 0000000..69ab58b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    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 == 0)
+    return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));
+
+  while (p_nd->m_p_right != 0)
+    p_nd = p_nd->m_p_right;
+
+  return std::make_pair(insert_leaf_new(r_value, p_nd, false), true);
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/node.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/node.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
new file mode 100644
index 0000000..f9bae22
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
@@ -0,0 +1,283 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    p_b->m_p_parent = p_parent;
+
+  p_grandparent->m_p_right = p_c;
+  if (p_c != 0)
+    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 != 0)
+    p_b->m_p_parent = p_parent;
+
+  p_grandparent->m_p_left = p_c;
+  if (p_c != 0)
+    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 != 0)
+    p_b->m_p_parent = p_parent;
+
+  p_grandparent->m_p_left = p_c;
+  if (p_c != 0)
+    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 != 0)
+    p_b->m_p_parent = p_parent;
+
+  p_grandparent->m_p_right = p_c;
+  if (p_c != 0)
+    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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_parent != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_grandparent != 0);
+
+  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
new file mode 100644
index 0000000..8a2eb07
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
@@ -0,0 +1,298 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 @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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..beef5bd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+  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 == 0);
+
+  p_target_r->m_p_left = base_type::m_p_head->m_p_parent;
+
+  _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != 0);
+  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 != 0);
+
+  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 != 0);
+
+  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 = 0;
+  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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/traits.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/standard_policies.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/standard_policies.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 0000000..af9b111
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+{
+  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(0)
+{
+  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 != 0; 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>(0)); }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
new file mode 100644
index 0000000..19e977b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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] == 0);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_max() const
+{
+  if (m_p_max == 0)
+    {
+      _GLIBCXX_DEBUG_ASSERT(base_type::empty());
+      return;
+    }
+
+  _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+  _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == 0);
+  _GLIBCXX_DEBUG_ASSERT(m_p_max->m_p_prev_or_parent == 0);
+  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 == 0)
+    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 == 0);
+      else
+	_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1);
+    }
+
+  if (p_nd->m_p_l_child != 0)
+    _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 == 0&&  p_nd->m_metadata == 0) ||(p_nd->m_p_l_child != 0&&  p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);
+
+  const bool marked_valid =(p_nd->m_p_l_child == 0&&  p_nd->m_metadata == 1) ||(p_nd->m_p_l_child != 0&&  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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
new file mode 100644
index 0000000..4431a4c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
@@ -0,0 +1,296 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+
+  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 != 0)
+    {
+      node_pointer p_next_add = p_add->m_p_next_sibling;
+
+      p_add->m_metadata = p_add->m_p_l_child == 0?
+	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 != 0)
+    {
+      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] != 0)
+    {
+      _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] = 0;
+
+      ++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 = 0;
+
+  const size_type rnk_bnd = rank_bound();
+
+  size_type i = 0;
+
+  while (i < rnk_bnd)
+    {
+      if (m_a_aux[i] != 0)
+        {
+	  make_root_and_link(m_a_aux[i]);
+
+	  m_a_aux[i] = 0;
+        }
+
+      ++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) != 0)
+    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 != 0&&  p_fix->m_p_next_sibling != p_parent)
+    p_fix = p_fix->m_p_next_sibling;
+
+  if (p_fix != 0)
+    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 = 0;
+}
+
+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 != 0)
+    {
+      ++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 = 0;
+
+  while (p_cur != 0)
+    {
+      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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
new file mode 100644
index 0000000..ef60add
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0);
+  return m_p_max->m_value;
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
new file mode 100644
index 0000000..2f56abd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
@@ -0,0 +1,326 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 = 0;
+
+  if (base_type::m_p_root == 0)
+    {
+      p_nd->m_p_next_sibling = 0;
+
+      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 = 0;
+
+  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 == 0?
+    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 = 0;
+
+  p_nd->m_p_next_sibling = base_type::m_p_root;
+
+  if (base_type::m_p_root != 0)
+    base_type::m_p_root->m_p_prev_or_parent = 0;
+
+  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 == 0)
+        {
+	  fix_root(p_y);
+
+	  return;
+        }
+      else if (p_y->m_metadata == 1&&  p_y->m_p_next_sibling == 0)
+        {
+	  if (p_y->m_p_l_child != 0)
+            {
+	      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 != 0);
+
+	  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 == 0&& 
+                p_y->m_metadata == 2) ||(p_y->m_p_l_child != 0&& 
+					 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 == 0);
+
+  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 != 0);
+
+  _GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;)
+    _GLIBCXX_DEBUG_ASSERT(p_w != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == 0);
+  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == 0);
+
+  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 = 0;
+
+  _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 != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == 0);
+
+  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 != 0);
+
+  node_pointer p_w = p_y->m_p_l_child;
+  _GLIBCXX_DEBUG_ASSERT(p_w != 0);
+  _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != 0);
+
+  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 != 0);
+  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 != 0);
+
+  --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 != 0);
+
+  if (p_y->m_p_next_sibling != 0)
+    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 != 0);
+
+  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 = 0;
+
+      make_root_and_link(p_nd);
+
+      _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+        return;
+    }
+
+  if (p_nd->m_p_prev_or_parent == 0)
+    {
+      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 != 0);
+
+  if (p_nd->m_p_next_sibling != 0)
+    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 == 0 || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
+    m_p_max = p_nd;
+}
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
new file mode 100644
index 0000000..2adf5a5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 != 0)
+    {
+      _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 = 0;
+
+  base_type::m_p_root = 0;
+
+  while (p_cur != 0)
+    {
+      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 != 0)
+    {
+      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 = 0;
+  other.m_size = 0;
+  other.m_p_max = 0;
+
+  _GLIBCXX_DEBUG_ONLY(assert_valid();)
+    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+    }
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
new file mode 100644
index 0000000..b8c19a5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_trace_base.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_trace_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
new file mode 100644
index 0000000..cb8e247
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
@@ -0,0 +1,181 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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();
+
+  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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
new file mode 100644
index 0000000..2ecad89
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
new file mode 100644
index 0000000..8b2c6b5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 std::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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/type_utils.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/type_utils.hpp
new file mode 100644
index 0000000..143110c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/type_utils.hpp
@@ -0,0 +1,167 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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/8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/types_traits.hpp
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/types_traits.hpp
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
new file mode 100644
index 0000000..1641792
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+  { }
+
+  // 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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
new file mode 100644
index 0000000..1cda69b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
@@ -0,0 +1,151 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+  { }
+
+  // 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 != 0);
+
+    return (m_p_value);
+  }
+
+  // Access.
+  inline const_reference
+  operator*() const
+  {
+    _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
+
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
new file mode 100644
index 0000000..1aaa682
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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_(0, PB_DS_GEN_POS(), 0)
+  { }
+
+  // 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 != 0);
+
+    return (const_cast<pointer>(base_type::m_p_value));
+  }
+
+  // Access.
+  inline reference
+  operator*() const
+  {
+    _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != 0);
+
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
new file mode 100644
index 0000000..e17a5bf
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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(0)
+  { }
+
+  // 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 != 0);
+
+    return (m_p_value);
+  }
+
+  // Access.
+  inline reference
+  operator*() const
+  {
+    _GLIBCXX_DEBUG_ASSERT(m_p_value != 0);
+
+    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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/exception.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/exception.hpp
new file mode 100644
index 0000000..b34e3ed
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/exception.hpp
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/hash_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/hash_policy.hpp
new file mode 100644
index 0000000..f3bc86e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/hash_policy.hpp
@@ -0,0 +1,605 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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 = std::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 = std::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 = std::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 = std::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 = std::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 = std::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 = std::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 std::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 = std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/list_update_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/list_update_policy.hpp
new file mode 100644
index 0000000..54a67c6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/list_update_policy.hpp
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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<std::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<std::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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/priority_queue.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/priority_queue.hpp
new file mode 100644
index 0000000..b6088e7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/priority_queue.hpp
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tag_and_trait.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tag_and_trait.hpp
new file mode 100644
index 0000000..ef44533
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tag_and_trait.hpp
@@ -0,0 +1,364 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tree_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tree_policy.hpp
new file mode 100644
index 0000000..4af1adb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tree_policy.hpp
@@ -0,0 +1,163 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/trie_policy.hpp b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/trie_policy.hpp
new file mode 100644
index 0000000..fc45210
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/trie_policy.hpp
@@ -0,0 +1,356 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 <bits/c++config.h>
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pod_char_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pod_char_traits.h
new file mode 100644
index 0000000..3c9f098
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pod_char_traits.h
@@ -0,0 +1,188 @@
+// 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pointer.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pointer.h
new file mode 100644
index 0000000..158ae52
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pointer.h
@@ -0,0 +1,570 @@
+// Custom pointer adapter and sample storage policies
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+ *  This file is a GNU extension to the Standard C++ Library.
+ *
+ *  @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
+
+#pragma GCC system_header
+
+#include <iosfwd>
+#include <bits/stl_iterator_base_types.h>
+#include <ext/cast.h>
+#include <ext/type_traits.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /** 
+   * @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:
+#ifdef _GLIBCXX_USE_LONG_LONG
+      typedef __gnu_cxx::__conditional_type<
+	 (sizeof(unsigned long) >= sizeof(void*)),
+	 unsigned long, unsigned long long>::__type _UIntPtrType;
+#else
+      typedef unsigned long _UIntPtrType;
+#endif
+      _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:
+#ifdef _GLIBCXX_USE_LONG_LONG
+      typedef __gnu_cxx::__conditional_type<
+	 (sizeof(unsigned long) >= sizeof(void*)),
+	 unsigned long, unsigned long long>::__type _UIntPtrType;
+#else
+      typedef unsigned long _UIntPtrType;
+#endif
+       _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)
+      {
+        _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) \
+  template<typename _Tp1, typename _Tp2> \
+    inline bool \
+    operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \
+    { return __lhs.get() OPERATOR __rhs; } \
+\
+  template<typename _Tp1, typename _Tp2> \
+    inline bool \
+    operator OPERATOR(_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \
+    { return __lhs OPERATOR __rhs.get(); } \
+\
+  template<typename _Tp1, typename _Tp2> \
+    inline bool \
+    operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, \
+                              const _Pointer_adapter<_Tp2>& __rhs) \
+    { return __lhs.get() OPERATOR __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_VERSION
+} // namespace
+
+#endif // _POINTER_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pool_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pool_allocator.h
new file mode 100644
index 0000000..66ddced
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pool_allocator.h
@@ -0,0 +1,266 @@
+// Allocators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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)); }
+      
+      _GLIBCXX_CONST _Obj* volatile*
+      _M_get_free_list(size_t __bytes) throw ();
+    
+      __mutex&
+      _M_get_mutex() throw ();
+
+      // 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 std::__addressof(__x); }
+
+      const_pointer
+      address(const_reference __x) const { return std::__addressof(__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 (__n > this->max_size())
+	    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 (__ret == 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rb_tree b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rb_tree
new file mode 100644
index 0000000..4293a75
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rb_tree
@@ -0,0 +1,96 @@
+// 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rc_string_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rc_string_base.h
new file mode 100644
index 0000000..4a27ff6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rc_string_base.h
@@ -0,0 +1,733 @@
+// Reference-counted versatile string base -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/vstring.h}
+ */
+
+#ifndef _RC_STRING_BASE_H
+#define _RC_STRING_BASE_H 1
+
+#include <ext/atomicity.h>
+#include <bits/stl_iterator_base_funcs.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  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 @a 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 <em>empty string</em> _Rep object already @a 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()
+      {
+	// Be race-detector-friendly.  For more info see bits/c++config.
+	_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_rep()->_M_info.
+						_M_refcount);
+	if (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount,
+					-1) <= 0)
+	  {
+	    _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_rep()->_M_info.
+						   _M_refcount);
+	    _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_aux_2(static_cast<size_type>(__beg),
+				    __end, __a); }
+
+      static _CharT*
+      _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a)
+      { return _S_construct(__req, __c, __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_dataplus)
+      { __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 (__is_null_pointer(__beg) && __beg != __end)
+	  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_VERSION
+} // namespace
+
+#endif /* _RC_STRING_BASE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rope b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rope
new file mode 100644
index 0000000..4292151
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rope
@@ -0,0 +1,2965 @@
+// 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
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+  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;
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{ 
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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;
+      }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace tr1
+} // namespace std
+
+# include <ext/ropeimpl.h>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/ropeimpl.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/ropeimpl.h
new file mode 100644
index 0000000..467b8fd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/ropeimpl.h
@@ -0,0 +1,1704 @@
+// SGI's rope class implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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.
+ *  Do not attempt to use it directly. @headername{ext/rope}
+ */
+
+#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
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/slist b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/slist
new file mode 100644
index 0000000..e678190
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/slist
@@ -0,0 +1,1083 @@
+// 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/sso_string_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/sso_string_base.h
new file mode 100644
index 0000000..39a62d6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/sso_string_base.h
@@ -0,0 +1,598 @@
+// Short-string-optimized versatile string base -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/vstring.h}
+ */
+
+#ifndef _SSO_STRING_BASE_H
+#define _SSO_STRING_BASE_H 1
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_dangling
+	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_aux_2(static_cast<size_type>(__beg), __end); }
+
+      void
+      _M_construct_aux_2(size_type __req, _CharT __c)
+      { _M_construct(__req, __c); }
+
+      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_no_wipe(size_type __n)
+      {
+	_M_length(__n);
+	traits_type::assign(_M_data()[__n], _CharT());
+      }
+
+      void
+      _M_set_length(size_type __n)
+      {
+#if __google_stl_debug_string_dangling
+	if (__n + 1 < _M_length())
+	  {
+	    // Wipe the storage with 0xCD.
+	    // Also wipes the old NUL terminator.
+	    __builtin_memset(_M_data() + __n + 1, 0xcd, _M_length() - __n);
+	  }
+#endif
+	  _M_set_length_no_wipe(__n);
+      }
+
+      __sso_string_base()
+      : _M_dataplus(_M_local_data)
+      { _M_set_length_no_wipe(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)
+    {
+      if (this == &__rcs)
+	return;
+
+      // _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_no_wipe(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);
+		    this->_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_no_wipe(__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 (__is_null_pointer(__beg) && __beg != __end)
+	  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
+	  { this->_S_copy_chars(_M_data(), __beg, __end); }
+	__catch(...)
+	  {
+	    _M_dispose();
+	    __throw_exception_again;
+	  }
+
+	_M_set_length_no_wipe(__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)
+	this->_S_assign(_M_data(), __n, __c);
+
+      _M_set_length_no_wipe(__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)
+	    this->_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);
+	      this->_S_copy(__tmp, _M_data(), _M_length() + 1);
+	      _M_dispose();
+	      _M_data(__tmp);
+	      _M_capacity(__res);
+	    }
+	  else if (!_M_is_local())
+	    {
+	      this->_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,
+	      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)
+	this->_S_copy(__r, _M_data(), __pos);
+      if (__s && __len2)
+	this->_S_copy(__r + __pos, __s, __len2);
+      if (__how_much)
+	this->_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)
+	this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
+
+      _M_set_length(_M_length() - __n);
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _SSO_STRING_BASE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_filebuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_filebuf.h
new file mode 100644
index 0000000..5ab2ff7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_filebuf.h
@@ -0,0 +1,162 @@
+// File descriptor layer for filebuf -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief Provides a layer of compatibility for C/POSIX.
+   *  @ingroup io
+   *
+   *  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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_sync_filebuf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_sync_filebuf.h
new file mode 100644
index 0000000..4b60149
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_sync_filebuf.h
@@ -0,0 +1,290 @@
+// Iostreams wrapper for stdio FILE* -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief Provides a layer of compatibility for C.
+   *  @ingroup io
+   *
+   *  This GNU extension provides extensions for working with standard
+   *  C FILE*'s.  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_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_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/string_conversions.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/string_conversions.h
new file mode 100644
index 0000000..f85ab99
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/string_conversions.h
@@ -0,0 +1,101 @@
+// String Conversions -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/string_conversions.h
+ *  This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _STRING_CONVERSIONS_H
+#define _STRING_CONVERSIONS_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <ext/numeric_traits.h>
+#include <bits/functexcept.h>
+#include <cstdlib>
+#include <cwchar>
+#include <cstdio>
+#include <cerrno>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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_VERSION
+} // namespace
+
+#endif // _STRING_CONVERSIONS_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/throw_allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/throw_allocator.h
new file mode 100644
index 0000000..778b8de
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/throw_allocator.h
@@ -0,0 +1,765 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research 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 two exception-generating types (throw_value, throw_allocator)
+ *  intended to be used as value and allocator types while testing
+ *  exception safety in templatized containers and algorithms. The
+ *  allocator has additional log and debug features. The exception
+ *  generated is of type forced_exception_error.
+ */
+
+#ifndef _THROW_ALLOCATOR_H
+#define _THROW_ALLOCATOR_H 1
+
+#include <cmath>
+#include <ctime>
+#include <map>
+#include <string>
+#include <ostream>
+#include <stdexcept>
+#include <utility>
+#include <bits/functexcept.h>
+#include <bits/move.h>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <functional>
+# include <random>
+#else
+# include <tr1/functional>
+# include <tr1/random>
+#endif
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @brief Thown by exception safety machinery.
+   *  @ingroup exceptions
+   */
+  struct forced_error : public std::exception
+  { };
+
+  // Substitute for forced_error object when -fno-exceptions.
+  inline void
+  __throw_forced_error()
+  {
+#if __EXCEPTIONS
+    throw forced_error();
+#else
+    __builtin_abort();
+#endif
+  }
+
+
+  /**
+   *  @brief Base class for checking address and label information
+   *  about allocations. Create a std::map between the allocated
+   *  address (void*) and a datum for annotations, which are a pair of
+   *  numbers corresponding to label and allocated size.
+   */
+  struct annotate_base
+  {
+    annotate_base()
+    {
+      label();
+      map();
+    }
+
+    static void
+    set_label(size_t l)
+    { label() = l; }
+
+    static size_t
+    get_label()
+    { return label(); }
+
+    void
+    insert(void* p, size_t size)
+    {
+      if (!p)
+	{
+	  std::string error("annotate_base::insert null insert!\n");
+	  log_to_string(error, make_entry(p, size));
+	  std::__throw_logic_error(error.c_str());
+	}
+
+      const_iterator found = map().find(p);
+      if (found != map().end())
+	{
+	  std::string error("annotate_base::insert double insert!\n");
+	  log_to_string(error, make_entry(p, size));
+	  log_to_string(error, *found);
+	  std::__throw_logic_error(error.c_str());
+	}
+
+      map().insert(make_entry(p, size));
+    }
+
+    void
+    erase(void* p, size_t size)
+    {
+      check_allocated(p, size);
+      map().erase(p);
+    }
+
+    // See if a particular address and allocation size has been saved.
+    inline void
+    check_allocated(void* p, size_t size)
+    {
+      const_iterator found = map().find(p);
+      if (found == map().end())
+	{
+	  std::string error("annotate_base::check_allocated by value "
+			    "null erase!\n");
+	  log_to_string(error, make_entry(p, size));
+	  std::__throw_logic_error(error.c_str());
+	}
+
+      if (found->second.second != size)
+	{
+	  std::string error("annotate_base::check_allocated by value "
+			    "wrong-size erase!\n");
+	  log_to_string(error, make_entry(p, size));
+	  log_to_string(error, *found);
+	  std::__throw_logic_error(error.c_str());
+	}
+    }
+
+    // See if a given label has been allocated.
+    inline void
+    check_allocated(size_t label)
+    {
+      const_iterator beg = map().begin();
+      const_iterator end = map().end();
+      std::string found;
+      while (beg != end)
+	{
+	  if (beg->second.first == label)
+	    log_to_string(found, *beg);
+	  ++beg;
+	}
+
+      if (!found.empty())
+	{
+	  std::string error("annotate_base::check_allocated by label\n");
+	  error += found;
+	  std::__throw_logic_error(error.c_str());
+	}
+    }
+
+  private:
+    typedef std::pair<size_t, size_t> 		data_type;
+    typedef std::map<void*, 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 annotate_base&);
+
+    entry_type
+    make_entry(void* p, size_t size)
+    { return std::make_pair(p, data_type(get_label(), size)); }
+
+    void
+    log_to_string(std::string& s, const_reference ref) const
+    {
+      char buf[40];
+      const char tab('\t');
+      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 += tab;
+      s += "address: ";
+      __builtin_sprintf(buf, "%p", ref.first);
+      s += buf;
+      s += '\n';
+    }
+
+    static size_t&
+    label()
+    {
+      static size_t _S_label(std::numeric_limits<size_t>::max());
+      return _S_label;
+    }
+
+    static map_type&
+    map()
+    {
+      static map_type _S_map;
+      return _S_map;
+    }
+  };
+
+  inline std::ostream&
+  operator<<(std::ostream& os, const annotate_base& __b)
+  {
+    std::string error;
+    typedef annotate_base base_type;
+    base_type::const_iterator beg = __b.map().begin();
+    base_type::const_iterator end = __b.map().end();
+    for (; beg != end; ++beg)
+      __b.log_to_string(error, *beg);
+    return os << error;
+  }
+
+
+  /**
+   *  @brief Base struct for condition policy.
+   *
+   * Requires a public member function with the signature
+   * void throw_conditionally()
+   */
+  struct condition_base
+  {
+    virtual ~condition_base() { };
+  };
+
+
+  /**
+   *  @brief Base class for incremental control and throw.
+   */
+  struct limit_condition : public condition_base
+  {
+    // Scope-level adjustor objects: set limit for throw at the
+    // beginning of a scope block, and restores to previous limit when
+    // object is destroyed on exiting the block.
+    struct adjustor_base
+    {
+    private:
+      const size_t _M_orig;
+
+    public:
+      adjustor_base() : _M_orig(limit()) { }
+
+      virtual
+      ~adjustor_base() { set_limit(_M_orig); }
+    };
+
+    /// Never enter the condition.
+    struct never_adjustor : public adjustor_base
+    {
+      never_adjustor() { set_limit(std::numeric_limits<size_t>::max()); }
+    };
+
+    /// Always enter the condition.
+    struct always_adjustor : public adjustor_base
+    {
+      always_adjustor() { set_limit(count()); }
+    };
+
+    /// Enter the nth condition.
+    struct limit_adjustor : public adjustor_base
+    {
+      limit_adjustor(const size_t __l) { set_limit(__l); }
+    };
+
+    // Increment _S_count every time called.
+    // If _S_count matches the limit count, throw.
+    static void
+    throw_conditionally()
+    {
+      if (count() == limit())
+	__throw_forced_error();
+      ++count();
+    }
+
+    static size_t&
+    count()
+    {
+      static size_t _S_count(0);
+      return _S_count;
+    }
+
+    static size_t&
+    limit()
+    {
+      static size_t _S_limit(std::numeric_limits<size_t>::max());
+      return _S_limit;
+    }
+
+    // Zero the throw counter, set limit to argument.
+    static void
+    set_limit(const size_t __l)
+    {
+      limit() = __l;
+      count() = 0;
+    }
+  };
+
+
+  /**
+   *  @brief Base class for random probability control and throw.
+   */
+  struct random_condition : public condition_base
+  {
+    // Scope-level adjustor objects: set probability for throw at the
+    // beginning of a scope block, and restores to previous
+    // probability when object is destroyed on exiting the block.
+    struct adjustor_base
+    {
+    private:
+      const double _M_orig;
+
+    public:
+      adjustor_base() : _M_orig(probability()) { }
+
+      virtual ~adjustor_base()
+      { set_probability(_M_orig); }
+    };
+
+    /// Group condition.
+    struct group_adjustor : public adjustor_base
+    {
+      group_adjustor(size_t size)
+      { set_probability(1 - std::pow(double(1 - probability()),
+				     double(0.5 / (size + 1))));
+      }
+    };
+
+    /// Never enter the condition.
+    struct never_adjustor : public adjustor_base
+    {
+      never_adjustor() { set_probability(0); }
+    };
+
+    /// Always enter the condition.
+    struct always_adjustor : public adjustor_base
+    {
+      always_adjustor() { set_probability(1); }
+    };
+
+    random_condition()
+    {
+      probability();
+      engine();
+    }
+
+    static void
+    set_probability(double __p)
+    { probability() = __p; }
+
+    static void
+    throw_conditionally()
+    {
+      if (generate() < probability())
+	__throw_forced_error();
+    }
+
+    void
+    seed(unsigned long __s)
+    { engine().seed(__s); }
+
+  private:
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    typedef std::uniform_real_distribution<double> 	distribution_type;
+    typedef std::mt19937 				engine_type;
+#else
+    typedef std::tr1::uniform_real<double> 		distribution_type;
+    typedef std::tr1::mt19937 				engine_type;
+#endif
+
+    static double
+    generate()
+    {
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      const distribution_type distribution(0, 1);
+      static auto generator = std::bind(distribution, engine());
+#else
+      // Use variate_generator to get normalized results.
+      typedef std::tr1::variate_generator<engine_type, distribution_type> gen_t;
+      distribution_type distribution(0, 1);
+      static gen_t generator(engine(), distribution);
+#endif
+
+      double random = generator();
+      if (random < distribution.min() || random > distribution.max())
+	{
+	  std::string __s("random_condition::generate");
+	  __s += "\n";
+	  __s += "random number generated is: ";
+	  char buf[40];
+	  __builtin_sprintf(buf, "%f", random);
+	  __s += buf;
+	  std::__throw_out_of_range(__s.c_str());
+	}
+
+      return random;
+    }
+
+    static double&
+    probability()
+    {
+      static double _S_p;
+      return _S_p;
+    }
+
+    static engine_type&
+    engine()
+    {
+      static engine_type _S_e;
+      return _S_e;
+    }
+  };
+
+
+  /**
+   *  @brief Class with exception generation control. Intended to be
+   *  used as a value_type in templatized code.
+   *
+   *  Note: Destructor not allowed to throw.
+   */
+  template<typename _Cond>
+    struct throw_value_base : public _Cond
+    {
+      typedef _Cond  				condition_type;
+
+      using condition_type::throw_conditionally;
+
+      std::size_t			       	_M_i;
+
+#ifndef _GLIBCXX_IS_AGGREGATE
+      throw_value_base() : _M_i(0)
+      { throw_conditionally(); }
+
+      throw_value_base(const throw_value_base& __v) : _M_i(__v._M_i)
+      { throw_conditionally(); }
+
+      explicit throw_value_base(const std::size_t __i) : _M_i(__i)
+      { throw_conditionally(); }
+#endif
+
+      throw_value_base&
+      operator=(const throw_value_base& __v)
+      {
+	throw_conditionally();
+	_M_i = __v._M_i;
+	return *this;
+      }
+
+      throw_value_base&
+      operator++()
+      {
+	throw_conditionally();
+	++_M_i;
+	return *this;
+      }
+    };
+
+  template<typename _Cond>
+    inline void
+    swap(throw_value_base<_Cond>& __a, throw_value_base<_Cond>& __b)
+    {
+      typedef throw_value_base<_Cond> throw_value;
+      throw_value::throw_conditionally();
+      throw_value orig(__a);
+      __a = __b;
+      __b = orig;
+    }
+
+  // General instantiable types requirements.
+  template<typename _Cond>
+    inline bool
+    operator==(const throw_value_base<_Cond>& __a,
+	       const throw_value_base<_Cond>& __b)
+    {
+      typedef throw_value_base<_Cond> throw_value;
+      throw_value::throw_conditionally();
+      bool __ret = __a._M_i == __b._M_i;
+      return __ret;
+    }
+
+  template<typename _Cond>
+    inline bool
+    operator<(const throw_value_base<_Cond>& __a,
+	      const throw_value_base<_Cond>& __b)
+    {
+      typedef throw_value_base<_Cond> throw_value;
+      throw_value::throw_conditionally();
+      bool __ret = __a._M_i < __b._M_i;
+      return __ret;
+    }
+
+  // Numeric algorithms instantiable types requirements.
+  template<typename _Cond>
+    inline throw_value_base<_Cond>
+    operator+(const throw_value_base<_Cond>& __a,
+	      const throw_value_base<_Cond>& __b)
+    {
+      typedef throw_value_base<_Cond> throw_value;
+      throw_value::throw_conditionally();
+      throw_value __ret(__a._M_i + __b._M_i);
+      return __ret;
+    }
+
+  template<typename _Cond>
+    inline throw_value_base<_Cond>
+    operator-(const throw_value_base<_Cond>& __a,
+	      const throw_value_base<_Cond>& __b)
+    {
+      typedef throw_value_base<_Cond> throw_value;
+      throw_value::throw_conditionally();
+      throw_value __ret(__a._M_i - __b._M_i);
+      return __ret;
+    }
+
+  template<typename _Cond>
+    inline throw_value_base<_Cond>
+    operator*(const throw_value_base<_Cond>& __a,
+	      const throw_value_base<_Cond>& __b)
+    {
+      typedef throw_value_base<_Cond> throw_value;
+      throw_value::throw_conditionally();
+      throw_value __ret(__a._M_i * __b._M_i);
+      return __ret;
+    }
+
+
+  /// Type throwing via limit condition.
+  struct throw_value_limit : public throw_value_base<limit_condition>
+  {
+    typedef throw_value_base<limit_condition> base_type;
+
+#ifndef _GLIBCXX_IS_AGGREGATE
+    throw_value_limit() { }
+
+    throw_value_limit(const throw_value_limit& __other)
+    : base_type(__other._M_i) { }
+
+    explicit throw_value_limit(const std::size_t __i) : base_type(__i) { }
+#endif
+  };
+
+  /// Type throwing via random condition.
+  struct throw_value_random : public throw_value_base<random_condition>
+  {
+    typedef throw_value_base<random_condition> base_type;
+
+#ifndef _GLIBCXX_IS_AGGREGATE
+    throw_value_random() { }
+
+    throw_value_random(const throw_value_random& __other)
+    : base_type(__other._M_i) { }
+
+
+    explicit throw_value_random(const std::size_t __i) : base_type(__i) { }
+#endif
+  };
+
+
+  /**
+   *  @brief Allocator class with logging and exception generation control.
+   * Intended to be used as an allocator_type in templatized code.
+   *  @ingroup allocators
+   *
+   *  Note: Deallocate not allowed to throw.
+   */
+  template<typename _Tp, typename _Cond>
+    class throw_allocator_base
+    : public annotate_base, public _Cond
+    {
+    public:
+      typedef size_t 				size_type;
+      typedef ptrdiff_t 			difference_type;
+      typedef _Tp 				value_type;
+      typedef value_type* 			pointer;
+      typedef const value_type* 		const_pointer;
+      typedef value_type& 			reference;
+      typedef const value_type& 		const_reference;
+
+    private:
+      typedef _Cond				condition_type;
+
+      std::allocator<value_type> 		_M_allocator;
+
+      using condition_type::throw_conditionally;
+
+    public:
+      size_type
+      max_size() const throw()
+      { return _M_allocator.max_size(); }
+
+      pointer
+      address(reference __x) const { return std::__addressof(__x); }
+
+      const_pointer
+      address(const_reference __x) const { return std::__addressof(__x); }
+
+      pointer
+      allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
+      {
+	if (__n > this->max_size())
+	  std::__throw_bad_alloc();
+
+	throw_conditionally();
+	pointer const a = _M_allocator.allocate(__n, hint);
+	insert(a, sizeof(value_type) * __n);
+	return a;
+      }
+
+      void
+      construct(pointer __p, const value_type& val)
+      { return _M_allocator.construct(__p, val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+	void
+	construct(pointer __p, _Args&&... __args)
+	{ return _M_allocator.construct(__p, std::forward<_Args>(__args)...); }
+#endif
+
+      void
+      destroy(pointer __p)
+      { _M_allocator.destroy(__p); }
+
+      void
+      deallocate(pointer __p, size_type __n)
+      {
+	erase(__p, sizeof(value_type) * __n);
+	_M_allocator.deallocate(__p, __n);
+      }
+
+      void
+      check_allocated(pointer __p, size_type __n)
+      {
+	size_type __t = sizeof(value_type) * __n;
+	annotate_base::check_allocated(__p, __t);
+      }
+
+      void
+      check_allocated(size_type __n)
+      { annotate_base::check_allocated(__n); }
+  };
+
+  template<typename _Tp, typename _Cond>
+    inline bool
+    operator==(const throw_allocator_base<_Tp, _Cond>&,
+	       const throw_allocator_base<_Tp, _Cond>&)
+    { return true; }
+
+  template<typename _Tp, typename _Cond>
+    inline bool
+    operator!=(const throw_allocator_base<_Tp, _Cond>&,
+	       const throw_allocator_base<_Tp, _Cond>&)
+    { return false; }
+
+  /// Allocator throwing via limit condition.
+  template<typename _Tp>
+    struct throw_allocator_limit
+    : public throw_allocator_base<_Tp, limit_condition>
+    {
+      template<typename _Tp1>
+	struct rebind
+	{ typedef throw_allocator_limit<_Tp1> other; };
+
+      throw_allocator_limit() throw() { }
+
+      throw_allocator_limit(const throw_allocator_limit&) throw() { }
+
+      template<typename _Tp1>
+	throw_allocator_limit(const throw_allocator_limit<_Tp1>&) throw() { }
+
+      ~throw_allocator_limit() throw() { }
+    };
+
+  /// Allocator throwing via random condition.
+  template<typename _Tp>
+    struct throw_allocator_random
+    : public throw_allocator_base<_Tp, random_condition>
+    {
+      template<typename _Tp1>
+	struct rebind
+	{ typedef throw_allocator_random<_Tp1> other; };
+
+      throw_allocator_random() throw() { }
+
+      throw_allocator_random(const throw_allocator_random&) throw() { }
+
+      template<typename _Tp1>
+	throw_allocator_random(const throw_allocator_random<_Tp1>&) throw() { }
+
+      ~throw_allocator_random() throw() { }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+# include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+  /// Explicit specialization of std::hash for __gnu_cxx::throw_value_limit.
+  template<>
+    struct hash<__gnu_cxx::throw_value_limit>
+    : public std::unary_function<__gnu_cxx::throw_value_limit, size_t>
+    {
+      size_t
+      operator()(const __gnu_cxx::throw_value_limit& __val) const
+      {
+	std::hash<std::size_t> __h;
+	size_t __result = __h(__val._M_i);
+	return __result;
+      }
+    };
+
+  /// Explicit specialization of std::hash for __gnu_cxx::throw_value_limit.
+  template<>
+    struct hash<__gnu_cxx::throw_value_random>
+    : public std::unary_function<__gnu_cxx::throw_value_random, size_t>
+    {
+      size_t
+      operator()(const __gnu_cxx::throw_value_random& __val) const
+      {
+	std::hash<std::size_t> __h;
+	size_t __result = __h(__val._M_i);
+	return __result;
+      }
+    };
+} // end namespace std
+#endif
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/type_traits.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/type_traits.h
new file mode 100644
index 0000000..51db03e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/type_traits.h
@@ -0,0 +1,214 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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; };
+
+  // No nested __type member for non-integer non-floating point types,
+  // allows this type to be used for SFINAE to constrain overloads in
+  // <cmath> and <complex> to only the intended types.
+  template<typename _Tp>
+    struct __promote<_Tp, false>
+    { };
+
+  template<>
+    struct __promote<long double>
+    { typedef long double __type; };
+
+  template<>
+    struct __promote<double>
+    { typedef double __type; };
+
+  template<>
+    struct __promote<float>
+    { typedef float __type; };
+
+  template<typename _Tp, typename _Up,
+           typename _Tp2 = typename __promote<_Tp>::__type,
+           typename _Up2 = typename __promote<_Up>::__type>
+    struct __promote_2
+    {
+      typedef __typeof__(_Tp2() + _Up2()) __type;
+    };
+
+  template<typename _Tp, typename _Up, typename _Vp,
+           typename _Tp2 = typename __promote<_Tp>::__type,
+           typename _Up2 = typename __promote<_Up>::__type,
+           typename _Vp2 = typename __promote<_Vp>::__type>
+    struct __promote_3
+    {
+      typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type;
+    };
+
+  template<typename _Tp, typename _Up, typename _Vp, typename _Wp,
+           typename _Tp2 = typename __promote<_Tp>::__type,
+           typename _Up2 = typename __promote<_Up>::__type,
+           typename _Vp2 = typename __promote<_Vp>::__type,
+           typename _Wp2 = typename __promote<_Wp>::__type>
+    struct __promote_4
+    {
+      typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/typelist.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/typelist.h
new file mode 100644
index 0000000..7f94ecd
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/typelist.h
@@ -0,0 +1,554 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research 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/typelist.h
+ *  This file is a GNU extension to the Standard C++ Library.
+ *
+ *  Contains typelist_chain definitions.
+ *  Typelists are an idea by Andrei Alexandrescu.
+ */
+
+#ifndef _TYPELIST_H
+#define _TYPELIST_H 1
+
+#include <ext/type_traits.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+/** @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_VERSION
+} // namespace
+
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+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_VERSION
+} // 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) >
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+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_VERSION
+} // namespace
+
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.h
new file mode 100644
index 0000000..19df375
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.h
@@ -0,0 +1,2819 @@
+// Versatile string -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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)) {                                                \
+    char buf[512];                                                     \
+    __builtin_snprintf(buf, sizeof(buf),                               \
+                      "%s:%d: %s: Assertion '%s' failed.\n",           \
+                      __FILE__, __LINE__, __func__, # _Condition);     \
+    std::__throw_runtime_error(buf);                                   \
+  }
+# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
+#endif
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @class __versa_string vstring.h
+   *  @brief  Template class __versa_string. 
+   *  @ingroup extensions
+   *
+   *  Data structure managing sequences of characters and
+   *  character-like objects. 
+   */
+  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 value_type&               	            reference;
+      typedef const value_type&                             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::move(__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)
+      {
+	// NB: DR 1204.
+	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()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /// A non-binding request to reduce capacity() to size().
+      void
+      shrink_to_fit()
+      {
+	__try
+	  { this->reserve(0); }
+	__catch(...)
+	  { }
+      }
+#endif
+
+      /**
+       *  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 
+       *  <code>*this == ""</code>.
+       */
+      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 operator[](0); }
+
+      /**
+       *  Returns a read-only (constant) reference to the data at the first
+       *  element of the %string.
+       */
+      const_reference
+      front() const
+      { return operator[](0); }
+
+      /**
+       *  Returns a read/write reference to the data at the last
+       *  element of the %string.
+       */
+      reference
+      back()
+      { return operator[](this->size() - 1); }
+
+      /**
+       *  Returns a read-only (constant) reference to the data at the
+       *  last element of the %string.
+       */
+      const_reference
+      back() const
+      { return operator[](this->size() - 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;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Set value to contents of another string.
+       *  @param  __str  Source string to use.
+       *  @return  Reference to this string.
+       *
+       *  This function sets this string to the exact contents of @a __str.
+       *  @a __str is a valid, but unspecified string.
+       */
+      __versa_string&
+      assign(__versa_string&& __str)
+      {
+	this->swap(__str);
+	return *this;
+      }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+      /**
+       *  @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 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 this->_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
+      swap(__versa_string& __s)
+      { 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 = this->_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, <em>\\0</em> 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);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
+	      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+    { return std::move(__lhs.append(__rhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+	      __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
+    { return std::move(__rhs.insert(0, __lhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
+	      __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
+    {
+      const auto __size = __lhs.size() + __rhs.size();
+      const bool __cond = (__size > __lhs.capacity()
+			   && __size <= __rhs.capacity());
+      return __cond ? std::move(__rhs.insert(0, __lhs))
+	            : std::move(__lhs.append(__rhs));
+    }
+
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(const _CharT* __lhs,
+	      __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
+    { return std::move(__rhs.insert(0, __lhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(_CharT __lhs,
+	      __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
+    { return std::move(__rhs.insert(0, 1, __lhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
+	      const _CharT* __rhs)
+    { return std::move(__lhs.append(__rhs)); }
+
+  template<typename _CharT, typename _Traits, typename _Alloc,
+	   template <typename, typename, typename> class _Base>
+    inline __versa_string<_CharT, _Traits, _Alloc, _Base>
+    operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
+	      _CharT __rhs)
+    { return std::move(__lhs.append(1, __rhs)); }
+#endif
+
+  // 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); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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 &apos;\n&apos; 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_VERSION
+} // namespace
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99))
+
+#include <ext/string_conversions.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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.
+
+  // DR 1261.
+  inline __vstring
+  to_string(int __val)
+  { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 * sizeof(int),
+					      "%d", __val); }
+
+  inline __vstring
+  to_string(unsigned __val)
+  { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
+					      4 * sizeof(unsigned),
+					      "%u", __val); }
+
+  inline __vstring
+  to_string(long __val)
+  { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
+					      4 * sizeof(long),
+					      "%ld", __val); }
+
+  inline __vstring
+  to_string(unsigned long __val)
+  { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
+					      4 * sizeof(unsigned long),
+					      "%lu", __val); }
+
+
+  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(float __val)
+  {
+    const int __n = __numeric_traits<float>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
+					      "%f", __val);
+  }
+
+  inline __vstring
+  to_string(double __val)
+  {
+    const int __n = __numeric_traits<double>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
+					      "%f", __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); }
+
+#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
+  // DR 1261.
+  inline __wvstring
+  to_wstring(int __val)
+  { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
+					       4 * sizeof(int),
+					       L"%d", __val); }
+
+  inline __wvstring
+  to_wstring(unsigned __val)
+  { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
+					       4 * sizeof(unsigned),
+					       L"%u", __val); }
+
+  inline __wvstring
+  to_wstring(long __val)
+  { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
+					       4 * sizeof(long),
+					       L"%ld", __val); }
+
+  inline __wvstring
+  to_wstring(unsigned long __val)
+  { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
+					       4 * sizeof(unsigned long),
+					       L"%lu", __val); }
+
+  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(float __val)
+  {
+    const int __n = __numeric_traits<float>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
+					       L"%f", __val);
+  }
+
+  inline __wvstring
+  to_wstring(double __val)
+  {
+    const int __n = __numeric_traits<double>::__max_exponent10 + 20;
+    return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
+					       L"%f", __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
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// std::hash specialization for __vstring.
+  template<>
+    struct hash<__gnu_cxx::__vstring>
+    : public __hash_base<size_t, __gnu_cxx::__vstring>
+    {
+      size_t
+      operator()(const __gnu_cxx::__vstring& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(), __s.length()); }
+    };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  /// std::hash specialization for __wvstring.
+  template<>
+    struct hash<__gnu_cxx::__wvstring>
+    : public __hash_base<size_t, __gnu_cxx::__wvstring>
+    {
+      size_t
+      operator()(const __gnu_cxx::__wvstring& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(),
+                                     __s.length() * sizeof(wchar_t)); }
+    };
+#endif
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+  /// std::hash specialization for __u16vstring.
+  template<>
+    struct hash<__gnu_cxx::__u16vstring>
+    : public __hash_base<size_t, __gnu_cxx::__u16vstring>
+    {
+      size_t
+      operator()(const __gnu_cxx::__u16vstring& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(),
+                                     __s.length() * sizeof(char16_t)); }
+    };
+
+  /// std::hash specialization for __u32vstring.
+  template<>
+    struct hash<__gnu_cxx::__u32vstring>
+    : public __hash_base<size_t, __gnu_cxx::__u32vstring>
+    {
+      size_t
+      operator()(const __gnu_cxx::__u32vstring& __s) const noexcept
+      { return std::_Hash_impl::hash(__s.data(),
+                                     __s.length() * sizeof(char32_t)); }
+    };
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* __GXX_EXPERIMENTAL_CXX0X__ */
+
+#include "vstring.tcc" 
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.tcc
new file mode 100644
index 0000000..588985b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.tcc
@@ -0,0 +1,702 @@
+// Versatile string -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/vstring.h}
+ */
+
+#ifndef _VSTRING_TCC
+#define _VSTRING_TCC 1
+
+#pragma GCC system_header
+
+#include <bits/cxxabi_forced.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 = this->_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 = this->_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 = this->_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 = this->_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 = this->_S_compare(__n1, __n2);
+      return __r;
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif // _VSTRING_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_fwd.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_fwd.h
new file mode 100644
index 0000000..ce8cf53
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_fwd.h
@@ -0,0 +1,90 @@
+// Versatile string forward -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/vstring.h}
+ */
+
+#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>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif /* _VSTRING_FWD_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_util.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_util.h
new file mode 100644
index 0000000..fdf3981
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_util.h
@@ -0,0 +1,184 @@
+// Versatile string utility -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ext/vstring.h}
+ */
+
+#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>
+#include <bits/range_access.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#endif /* _VSTRING_UTIL_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/fenv.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/fenv.h
new file mode 100644
index 0000000..2096e39
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/fenv.h
@@ -0,0 +1,81 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 _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
+{
+  // 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;
+} // namespace
+
+#endif // _GLIBCXX_USE_C99_FENV_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_FENV_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/forward_list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/forward_list
new file mode 100644
index 0000000..a1befcf
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/forward_list
@@ -0,0 +1,52 @@
+// <forward_list> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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 <bits/c++0x_warning.h>
+#else
+
+#include <bits/forward_list.h>
+#include <bits/range_access.h>
+#include <bits/forward_list.tcc>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/forward_list>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/forward_list>
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_FORWARD_LIST
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/fstream b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/fstream
new file mode 100644
index 0000000..8ad6e5c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/fstream
@@ -0,0 +1,923 @@
+// File based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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 @b uncommitted mode;
+       *  _M_reading == true for @b read mode;
+       *  _M_writing == true for @b 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 <em>put buffer area</em> 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, seekpos, and overflow
+      pos_type
+      _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state);
+      
+      int
+      _M_get_ext_pos(__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 (@b read mode);
+       *   __off == 0 upon overflow (@b write mode);
+       *   __off == -1 upon open, setbuf, seekoff/pos (@b 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(0, 0);
+      }
+    };
+
+  // [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(0), _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(0), _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_VERSION
+} // namespace
+
+#include <bits/fstream.tcc>
+
+#endif /* _GLIBCXX_FSTREAM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/functional b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/functional
new file mode 100644
index 0000000..45bee81
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/functional
@@ -0,0 +1,2271 @@
+// <functional> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+// 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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__
+
+#include <typeinfo>
+#include <new>
+#include <tuple>
+#include <type_traits>
+#include <bits/functexcept.h>
+#include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+_GLIBCXX_HAS_NESTED_TYPE(result_type)
+
+  /// 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; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes......)>
+    { typedef _Res result_type; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes...) const>
+    { typedef _Res result_type; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes......) const>
+    { typedef _Res result_type; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes...) volatile>
+    { typedef _Res result_type; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes......) volatile>
+    { typedef _Res result_type; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes...) const volatile>
+    { typedef _Res result_type; };
+
+  template<typename _Res, typename... _ArgTypes>
+    struct _Weak_result_type_impl<_Res(_ArgTypes......) const volatile>
+    { 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; };
+
+  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; };
+
+  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; };
+
+  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; };
+
+  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; };
+
+  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; };
+
+  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>
+    { };
+
+  /// 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;
+    };
+
+  /**
+   * 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 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(std::forward<_Args>(__args)...);
+    }
+
+  template<typename _Functor, typename... _Args>
+    inline
+    typename 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)(std::forward<_Args>(__args)...);
+    }
+
+  // To pick up function references (that will become function pointers)
+  template<typename _Functor, typename... _Args>
+    inline
+    typename 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(std::forward<_Args>(__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;
+
+  // None of the nested argument types.
+  template<typename _Tp>
+    struct _Reference_wrapper_base_impl<false, false, _Tp>
+    : _Weak_result_type<_Tp>
+    { };
+
+  // Nested argument_type only.
+  template<typename _Tp>
+    struct _Reference_wrapper_base_impl<true, false, _Tp>
+    : _Weak_result_type<_Tp>
+    {
+      typedef typename _Tp::argument_type argument_type;
+    };
+
+  // Nested first_argument_type and second_argument_type only.
+  template<typename _Tp>
+    struct _Reference_wrapper_base_impl<false, true, _Tp>
+    : _Weak_result_type<_Tp>
+    {
+      typedef typename _Tp::first_argument_type first_argument_type;
+      typedef typename _Tp::second_argument_type second_argument_type;
+    };
+
+  // All the nested argument types.
+   template<typename _Tp>
+    struct _Reference_wrapper_base_impl<true, true, _Tp>
+    : _Weak_result_type<_Tp>
+    {
+      typedef typename _Tp::argument_type argument_type;
+      typedef typename _Tp::first_argument_type first_argument_type;
+      typedef typename _Tp::second_argument_type second_argument_type;
+    };
+
+  _GLIBCXX_HAS_NESTED_TYPE(argument_type)
+  _GLIBCXX_HAS_NESTED_TYPE(first_argument_type)
+  _GLIBCXX_HAS_NESTED_TYPE(second_argument_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<
+      __has_argument_type<_Tp>::value,
+      __has_first_argument_type<_Tp>::value
+      && __has_second_argument_type<_Tp>::value,
+      _Tp>
+    { };
+
+  // - a function type (unary)
+  template<typename _Res, typename _T1>
+    struct _Reference_wrapper_base<_Res(_T1)>
+    : unary_function<_T1, _Res>
+    { };
+
+  template<typename _Res, typename _T1>
+    struct _Reference_wrapper_base<_Res(_T1) const>
+    : unary_function<_T1, _Res>
+    { };
+
+  template<typename _Res, typename _T1>
+    struct _Reference_wrapper_base<_Res(_T1) volatile>
+    : unary_function<_T1, _Res>
+    { };
+
+  template<typename _Res, typename _T1>
+    struct _Reference_wrapper_base<_Res(_T1) const volatile>
+    : 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>
+    { };
+
+  template<typename _Res, typename _T1, typename _T2>
+    struct _Reference_wrapper_base<_Res(_T1, _T2) const>
+    : binary_function<_T1, _T2, _Res>
+    { };
+
+  template<typename _Res, typename _T1, typename _T2>
+    struct _Reference_wrapper_base<_Res(_T1, _T2) volatile>
+    : binary_function<_T1, _T2, _Res>
+    { };
+
+  template<typename _Res, typename _T1, typename _T2>
+    struct _Reference_wrapper_base<_Res(_T1, _T2) const volatile>
+    : 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>
+    { };
+
+  /**
+   *  @brief Primary class template for reference_wrapper.
+   *  @ingroup functors
+   *  @{
+   */
+  template<typename _Tp>
+    class reference_wrapper
+    : public _Reference_wrapper_base<typename remove_cv<_Tp>::type>
+    {
+      _Tp* _M_data;
+
+    public:
+      typedef _Tp type;
+
+      reference_wrapper(_Tp& __indata)
+      : _M_data(std::__addressof(__indata))
+      { }
+
+      reference_wrapper(_Tp&&) = delete;
+
+      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<_Tp&(_Args&&...)>::type
+	operator()(_Args&&... __args) const
+	{
+	  return __invoke(get(), std::forward<_Args>(__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>
+    void ref(const _Tp&&) = delete;
+
+  template<typename _Tp>
+    void cref(const _Tp&&) = delete;
+
+  /// Partial specialization.
+  template<typename _Tp>
+    inline reference_wrapper<_Tp>
+    ref(reference_wrapper<_Tp> __t)
+    { return ref(__t.get()); }
+
+  /// Partial specialization.
+  template<typename _Tp>
+    inline reference_wrapper<const _Tp>
+    cref(reference_wrapper<_Tp> __t)
+    { return cref(__t.get()); }
+
+  // @} group functors
+
+  template<typename _MemberPointer>
+    class _Mem_fn;
+
+  /**
+   * 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)(std::forward<_ArgTypes>(__args)...); }
+
+      template<typename _Tp>
+	_Res
+	_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+	{ return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle pointers
+      _Res
+      operator()(_Class* __object, _ArgTypes... __args) const
+      { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle smart pointers, references and pointers to derived
+      template<typename _Tp>
+	_Res
+	operator()(_Tp& __object, _ArgTypes... __args) const
+	{
+	  return _M_call(__object, &__object,
+	      std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      template<typename _Tp>
+	_Res
+	_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+	{ return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle pointers
+      _Res
+      operator()(const _Class* __object, _ArgTypes... __args) const
+      { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle smart pointers, references and pointers to derived
+      template<typename _Tp>
+	_Res operator()(_Tp& __object, _ArgTypes... __args) const
+	{
+	  return _M_call(__object, &__object,
+	      std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      template<typename _Tp>
+	_Res
+	_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+	{ return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle pointers
+      _Res
+      operator()(volatile _Class* __object, _ArgTypes... __args) const
+      { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle smart pointers, references and pointers to derived
+      template<typename _Tp>
+	_Res
+	operator()(_Tp& __object, _ArgTypes... __args) const
+	{
+	  return _M_call(__object, &__object,
+	      std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      template<typename _Tp>
+	_Res
+	_M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+	{ return ((*__ptr).*__pmf)(std::forward<_ArgTypes>(__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)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle pointers
+      _Res
+      operator()(const volatile _Class* __object, _ArgTypes... __args) const
+      { return (__object->*__pmf)(std::forward<_ArgTypes>(__args)...); }
+
+      // Handle smart pointers, references and pointers to derived
+      template<typename _Tp>
+	_Res operator()(_Tp& __object, _ArgTypes... __args) const
+	{
+	  return _M_call(__object, &__object,
+	      std::forward<_ArgTypes>(__args)...);
+	}
+
+    private:
+      _Functor __pmf;
+    };
+
+
+  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;
+    };
+
+  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.
+   *  @ingroup functors
+   */
+  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]
+   *  @ingroup binders
+   */
+  template<typename _Tp>
+    struct is_bind_expression
+    : public false_type { };
+
+  /**
+   *  @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]
+   *  @ingroup binders
+   */
+  template<typename _Tp>
+    struct is_placeholder
+    : public integral_constant<int, 0>
+    { };
+
+  /// The type of placeholder objects defined by libstdc++.
+  template<int _Num> struct _Placeholder { };
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+
+  /** @namespace std::placeholders
+   *  @brief ISO C++ 0x entities sub namespace for functional.
+   *  @ingroup binders
+   *
+   *  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
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+    extern const _Placeholder<1> _1;
+    extern const _Placeholder<2> _2;
+    extern const _Placeholder<3> _3;
+    extern const _Placeholder<4> _4;
+    extern const _Placeholder<5> _5;
+    extern const _Placeholder<6> _6;
+    extern const _Placeholder<7> _7;
+    extern const _Placeholder<8> _8;
+    extern const _Placeholder<9> _9;
+    extern const _Placeholder<10> _10;
+    extern const _Placeholder<11> _11;
+    extern const _Placeholder<12> _12;
+    extern const _Placeholder<13> _13;
+    extern const _Placeholder<14> _14;
+    extern const _Placeholder<15> _15;
+    extern const _Placeholder<16> _16;
+    extern const _Placeholder<17> _17;
+    extern const _Placeholder<18> _18;
+    extern const _Placeholder<19> _19;
+    extern const _Placeholder<20> _20;
+    extern const _Placeholder<21> _21;
+    extern const _Placeholder<22> _22;
+    extern const _Placeholder<23> _23;
+    extern const _Placeholder<24> _24;
+    extern const _Placeholder<25> _25;
+    extern const _Placeholder<26> _26;
+    extern const _Placeholder<27> _27;
+    extern const _Placeholder<28> _28;
+    extern const _Placeholder<29> _29;
+  _GLIBCXX_END_NAMESPACE_VERSION
+  }
+
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  Partial specialization of is_placeholder that provides the placeholder
+   *  number for the placeholder objects defined by libstdc++.
+   *  @ingroup binders
+   */
+  template<int _Num>
+    struct is_placeholder<_Placeholder<_Num> >
+    : public integral_constant<int, _Num>
+    { };
+
+  /**
+   * 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, _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 _CVArg, typename... _Args>
+	auto
+	operator()(_CVArg& __arg,
+		   tuple<_Args...>& __tuple) const volatile
+	-> decltype(__arg(declval<_Args>()...))
+	{
+	  // 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>
+	auto
+	__call(_CVArg& __arg, tuple<_Args...>& __tuple,
+	       const _Index_tuple<_Indexes...>&) const volatile
+	-> decltype(__arg(declval<_Args>()...))
+	{
+	  return __arg(std::forward<_Args>(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:
+	  typedef typename add_rvalue_reference<__base_type>::type type;
+	};
+
+      template<typename _Tuple>
+	typename result<_Mu(_Arg, _Tuple)>::type
+	operator()(const volatile _Arg&, _Tuple& __tuple) const volatile
+	{
+	  return std::forward<typename result<_Mu(_Arg, _Tuple)>::type>(
+	      ::std::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)>
+	{
+	  typedef typename add_lvalue_reference<_CVArg>::type type;
+	};
+
+      // Pick up the cv-qualifiers of the argument
+      template<typename _CVArg, typename _Tuple>
+	_CVArg&&
+	operator()(_CVArg&& __arg, _Tuple&) const volatile
+	{ return std::forward<_CVArg>(__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; }
+
+      static _Tp&&
+      __do_wrap(_Tp&& __x)
+      { return static_cast<_Tp&&>(__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); }
+    };
+
+  // Specialization needed to prevent "forming reference to void" errors when
+  // bind<void>() is called, because argument deduction instantiates
+  // _Maybe_wrap_member_pointer<void> outside the immediate context where
+  // SFINAE applies.
+  template<>
+    struct _Maybe_wrap_member_pointer<void>
+    {
+      typedef void type;
+    };
+
+  // std::get<I> for volatile-qualified tuples
+  template<size_t _Ind, typename... _Tp>
+    inline auto
+    __volget(volatile tuple<_Tp...>& __tuple)
+    -> typename tuple_element<_Ind, tuple<_Tp...>>::type volatile&
+    { return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); }
+
+  // std::get<I> for const-volatile-qualified tuples
+  template<size_t _Ind, typename... _Tp>
+    inline auto
+    __volget(const volatile tuple<_Tp...>& __tuple)
+    -> typename tuple_element<_Ind, tuple<_Tp...>>::type const volatile&
+    { return std::get<_Ind>(const_cast<const tuple<_Tp...>&>(__tuple)); }
+
+  /// 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 _Result, typename... _Args, int... _Indexes>
+	_Result
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (get<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as const
+      template<typename _Result, typename... _Args, int... _Indexes>
+	_Result
+	__call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (get<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as volatile
+      template<typename _Result, typename... _Args, int... _Indexes>
+	_Result
+	__call_v(tuple<_Args...>&& __args,
+		 _Index_tuple<_Indexes...>) volatile
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (__volget<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as const volatile
+      template<typename _Result, typename... _Args, int... _Indexes>
+	_Result
+	__call_c_v(tuple<_Args...>&& __args,
+		   _Index_tuple<_Indexes...>) const volatile
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (__volget<_Indexes>(_M_bound_args), __args)...);
+	}
+
+     public:
+      template<typename... _Args>
+	explicit _Bind(const _Functor& __f, _Args&&... __args)
+	: _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...)
+	{ }
+
+      template<typename... _Args>
+	explicit _Bind(_Functor&& __f, _Args&&... __args)
+	: _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...)
+	{ }
+
+      _Bind(const _Bind&) = default;
+
+      _Bind(_Bind&& __b)
+      : _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args))
+      { }
+
+      // Call unqualified
+      template<typename... _Args, typename _Result
+	= decltype( std::declval<_Functor>()(
+	      _Mu<_Bound_args>()( std::declval<_Bound_args&>(),
+				  std::declval<tuple<_Args...>&>() )... ) )>
+	_Result
+	operator()(_Args&&... __args)
+	{
+	  return this->__call<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+
+      // Call as const
+      template<typename... _Args, typename _Result
+	= decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0),
+		       typename add_const<_Functor>::type>::type>()(
+	      _Mu<_Bound_args>()( std::declval<const _Bound_args&>(),
+				  std::declval<tuple<_Args...>&>() )... ) )>
+	_Result
+	operator()(_Args&&... __args) const
+	{
+	  return this->__call_c<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+
+      // Call as volatile
+      template<typename... _Args, typename _Result
+	= decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0),
+                       typename add_volatile<_Functor>::type>::type>()(
+	      _Mu<_Bound_args>()( std::declval<volatile _Bound_args&>(),
+				  std::declval<tuple<_Args...>&>() )... ) )>
+	_Result
+	operator()(_Args&&... __args) volatile
+	{
+	  return this->__call_v<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+
+      // Call as const volatile
+      template<typename... _Args, typename _Result
+	= decltype( std::declval<typename enable_if<(sizeof...(_Args) >= 0),
+                       typename add_cv<_Functor>::type>::type>()(
+	      _Mu<_Bound_args>()( std::declval<const volatile _Bound_args&>(),
+				  std::declval<tuple<_Args...>&>() )... ) )>
+	_Result
+	operator()(_Args&&... __args) const volatile
+	{
+	  return this->__call_c_v<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__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;
+
+      // sfinae types
+      template<typename _Res>
+	struct __enable_if_void : enable_if<is_void<_Res>::value, int> { };
+      template<typename _Res>
+	struct __disable_if_void : enable_if<!is_void<_Res>::value, int> { };
+
+      // Call unqualified
+      template<typename _Res, typename... _Args, int... _Indexes>
+	_Result
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __disable_if_void<_Res>::type = 0)
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (get<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call unqualified, return void
+      template<typename _Res, typename... _Args, int... _Indexes>
+	void
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __enable_if_void<_Res>::type = 0)
+	{
+	  _M_f(_Mu<_Bound_args>()
+	       (get<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as const
+      template<typename _Res, typename... _Args, int... _Indexes>
+	_Result
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __disable_if_void<_Res>::type = 0) const
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (get<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as const, return void
+      template<typename _Res, typename... _Args, int... _Indexes>
+	void
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __enable_if_void<_Res>::type = 0) const
+	{
+	  _M_f(_Mu<_Bound_args>()
+	       (get<_Indexes>(_M_bound_args),  __args)...);
+	}
+
+      // Call as volatile
+      template<typename _Res, typename... _Args, int... _Indexes>
+	_Result
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __disable_if_void<_Res>::type = 0) volatile
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (__volget<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as volatile, return void
+      template<typename _Res, typename... _Args, int... _Indexes>
+	void
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __enable_if_void<_Res>::type = 0) volatile
+	{
+	  _M_f(_Mu<_Bound_args>()
+	       (__volget<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as const volatile
+      template<typename _Res, typename... _Args, int... _Indexes>
+	_Result
+	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>,
+	    typename __disable_if_void<_Res>::type = 0) const volatile
+	{
+	  return _M_f(_Mu<_Bound_args>()
+		      (__volget<_Indexes>(_M_bound_args), __args)...);
+	}
+
+      // Call as const volatile, return void
+      template<typename _Res, typename... _Args, int... _Indexes>
+	void
+	__call(tuple<_Args...>&& __args,
+	       _Index_tuple<_Indexes...>,
+	    typename __enable_if_void<_Res>::type = 0) const volatile
+	{
+	  _M_f(_Mu<_Bound_args>()
+	       (__volget<_Indexes>(_M_bound_args), __args)...);
+	}
+
+    public:
+      typedef _Result result_type;
+
+      template<typename... _Args>
+	explicit _Bind_result(const _Functor& __f, _Args&&... __args)
+	: _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...)
+	{ }
+
+      template<typename... _Args>
+	explicit _Bind_result(_Functor&& __f, _Args&&... __args)
+	: _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...)
+	{ }
+
+      _Bind_result(const _Bind_result&) = default;
+
+      _Bind_result(_Bind_result&& __b)
+      : _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args))
+      { }
+
+      // Call unqualified
+      template<typename... _Args>
+	result_type
+	operator()(_Args&&... __args)
+	{
+	  return this->__call<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+
+      // Call as const
+      template<typename... _Args>
+	result_type
+	operator()(_Args&&... __args) const
+	{
+	  return this->__call<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+
+      // Call as volatile
+      template<typename... _Args>
+	result_type
+	operator()(_Args&&... __args) volatile
+	{
+	  return this->__call<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+
+      // Call as const volatile
+      template<typename... _Args>
+	result_type
+	operator()(_Args&&... __args) const volatile
+	{
+	  return this->__call<_Result>(
+	      std::forward_as_tuple(std::forward<_Args>(__args)...),
+	      _Bound_indexes());
+	}
+    };
+
+  /**
+   *  @brief Class template _Bind is always a bind expression.
+   *  @ingroup binders
+   */
+  template<typename _Signature>
+    struct is_bind_expression<_Bind<_Signature> >
+    : public true_type { };
+
+  /**
+   *  @brief Class template _Bind is always a bind expression.
+   *  @ingroup binders
+   */
+  template<typename _Result, typename _Signature>
+    struct is_bind_expression<_Bind_result<_Result, _Signature> >
+    : public true_type { };
+
+  template<typename _Functor, typename... _ArgTypes>
+    struct _Bind_helper
+    {
+      typedef _Maybe_wrap_member_pointer<typename decay<_Functor>::type>
+	__maybe_type;
+      typedef typename __maybe_type::type __functor_type;
+      typedef _Bind<__functor_type(typename decay<_ArgTypes>::type...)> type;
+    };
+
+  /**
+   *  @brief Function template for std::bind.
+   *  @ingroup binders
+   */
+  template<typename _Functor, typename... _ArgTypes>
+    inline
+    typename _Bind_helper<_Functor, _ArgTypes...>::type
+    bind(_Functor&& __f, _ArgTypes&&... __args)
+    {
+      typedef _Bind_helper<_Functor, _ArgTypes...> __helper_type;
+      typedef typename __helper_type::__maybe_type __maybe_type;
+      typedef typename __helper_type::type __result_type;
+      return __result_type(__maybe_type::__do_wrap(std::forward<_Functor>(__f)),
+			   std::forward<_ArgTypes>(__args)...);
+    }
+
+  template<typename _Result, typename _Functor, typename... _ArgTypes>
+    struct _Bindres_helper
+    {
+      typedef _Maybe_wrap_member_pointer<typename decay<_Functor>::type>
+	__maybe_type;
+      typedef typename __maybe_type::type __functor_type;
+      typedef _Bind_result<_Result,
+			   __functor_type(typename decay<_ArgTypes>::type...)>
+	type;
+    };
+
+  /**
+   *  @brief Function template for std::bind<R>.
+   *  @ingroup binders
+   */
+  template<typename _Result, typename _Functor, typename... _ArgTypes>
+    inline
+    typename _Bindres_helper<_Result, _Functor, _ArgTypes...>::type
+    bind(_Functor&& __f, _ArgTypes&&... __args)
+    {
+      typedef _Bindres_helper<_Result, _Functor, _ArgTypes...> __helper_type;
+      typedef typename __helper_type::__maybe_type __maybe_type;
+      typedef typename __helper_type::type __result_type;
+      return __result_type(__maybe_type::__do_wrap(std::forward<_Functor>(__f)),
+			   std::forward<_ArgTypes>(__args)...);
+    }
+
+  /**
+   *  @brief Exception class thrown when class template function's
+   *  operator() is called with an empty target.
+   *  @ingroup exceptions
+   */
+  class bad_function_call : public std::exception
+  {
+  public:
+    virtual ~bad_function_call() throw();
+  };
+
+  /**
+   *  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? std::__addressof(__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, _Functor&& __f)
+	{ _M_init_functor(__functor, std::move(__f), _Local_storage()); }
+
+	template<typename _Signature>
+	  static bool
+	  _M_not_empty_function(const function<_Signature>& __f)
+	  { return static_cast<bool>(__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, _Functor&& __f, true_type)
+	{ new (__functor._M_access()) _Functor(std::move(__f)); }
+
+	static void
+	_M_init_functor(_Any_data& __functor, _Functor&& __f, false_type)
+	{ __functor._M_access<_Functor*>() = new _Functor(std::move(__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))(
+	    std::forward<_ArgTypes>(__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))(
+	    std::forward<_ArgTypes>(__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))(
+	      std::forward<_ArgTypes>(__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))(
+	    std::forward<_ArgTypes>(__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 mem_fn(_Base::_M_get_pointer(__functor)->__value)(
+	    std::forward<_ArgTypes>(__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)
+      {
+	mem_fn(_Base::_M_get_pointer(__functor)->__value)(
+	    std::forward<_ArgTypes>(__args)...);
+      }
+    };
+
+  /**
+   *  @brief Primary class template for std::function.
+   *  @ingroup functors
+   *
+   *  Polymorphic function wrapper.
+   */
+  template<typename _Res, typename... _ArgTypes>
+    class function<_Res(_ArgTypes...)>
+    : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>,
+      private _Function_base
+    {
+      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 Creates an empty function call wrapper.
+       *  @post @c !(bool)*this
+       */
+      function(nullptr_t) : _Function_base() { }
+
+      /**
+       *  @brief %Function copy constructor.
+       *  @param x A %function object with identical call signature.
+       *  @post @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 %Function move constructor.
+       *  @param x A %function object rvalue with identical call signature.
+       *
+       *  The newly-created %function contains the target of @a x
+       *  (if it has one).
+       */
+      function(function&& __x) : _Function_base()
+      {
+	__x.swap(*this);
+      }
+
+      // TODO: needs allocator_arg_t
+
+      /**
+       *  @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 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 move-assignment operator.
+       *  @param x A %function rvalue with identical call signature.
+       *  @returns @c *this
+       *
+       *  The target of @a x is moved 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=(function&& __x)
+      {
+	function(std::move(__x)).swap(*this);
+	return *this;
+      }
+
+      /**
+       *  @brief %Function assignment to zero.
+       *  @post @c !(bool)*this
+       *  @returns @c *this
+       *
+       *  The target of @c *this is deallocated, leaving it empty.
+       */
+      function&
+      operator=(nullptr_t)
+      {
+	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 enable_if<!is_integral<_Functor>::value, function&>::type
+	operator=(_Functor&& __f)
+	{
+	  function(std::forward<_Functor>(__f)).swap(*this);
+	  return *this;
+	}
+
+      /// @overload
+      template<typename _Functor>
+	typename enable_if<!is_integral<_Functor>::value, function&>::type
+	operator=(reference_wrapper<_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)
+      {
+	std::swap(_M_functor, __x._M_functor);
+	std::swap(_M_manager, __x._M_manager);
+	std::swap(_M_invoker, __x._M_invoker);
+      }
+
+      // TODO: needs allocator_arg_t
+      /*
+      template<typename _Functor, typename _Alloc>
+	void
+	assign(_Functor&& __f, const _Alloc& __a)
+	{
+	  function(allocator_arg, __a,
+		   std::forward<_Functor>(__f)).swap(*this);
+	}
+      */
+
+      // [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.
+       */
+      explicit operator bool() const
+      { return !_M_empty(); }
+
+      // [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:
+      typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
+      _Invoker_type _M_invoker;
+  };
+
+  // Out-of-line member definitions.
+  template<typename _Res, typename... _ArgTypes>
+    function<_Res(_ArgTypes...)>::
+    function(const function& __x)
+    : _Function_base()
+    {
+      if (static_cast<bool>(__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 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, std::move(__f));
+	  }
+      }
+
+  template<typename _Res, typename... _ArgTypes>
+    _Res
+    function<_Res(_ArgTypes...)>::
+    operator()(_ArgTypes... __args) const
+    {
+      if (_M_empty())
+	__throw_bad_function_call();
+      return _M_invoker(_M_functor, std::forward<_ArgTypes>(__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
+
+  // [20.7.15.2.6] 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 _Res, typename... _Args>
+    inline bool
+    operator==(const function<_Res(_Args...)>& __f, nullptr_t)
+    { return !static_cast<bool>(__f); }
+
+  /// @overload
+  template<typename _Res, typename... _Args>
+    inline bool
+    operator==(nullptr_t, const function<_Res(_Args...)>& __f)
+    { return !static_cast<bool>(__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 _Res, typename... _Args>
+    inline bool
+    operator!=(const function<_Res(_Args...)>& __f, nullptr_t)
+    { return static_cast<bool>(__f); }
+
+  /// @overload
+  template<typename _Res, typename... _Args>
+    inline bool
+    operator!=(nullptr_t, const function<_Res(_Args...)>& __f)
+    { return static_cast<bool>(__f); }
+
+  // [20.7.15.2.7] specialized algorithms
+
+  /**
+   *  @brief Swap the targets of two polymorphic function object wrappers.
+   *
+   *  This function will not throw an %exception.
+   */
+  template<typename _Res, typename... _Args>
+    inline void
+    swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y)
+    { __x.swap(__y); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_FUNCTIONAL
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/future b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/future
new file mode 100644
index 0000000..970ce76
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/future
@@ -0,0 +1,1393 @@
+// <future> -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/future
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_FUTURE
+#define _GLIBCXX_FUTURE 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <functional>
+#include <memory>
+#include <mutex>
+#include <thread>
+#include <condition_variable>
+#include <system_error>
+#include <exception>
+#include <atomic>
+#include <bits/functexcept.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup futures Futures
+   * @ingroup concurrency
+   *
+   * Classes for futures support.
+   * @{
+   */
+
+  /// Error code for futures
+  enum class future_errc
+  {
+    broken_promise,
+    future_already_retrieved,
+    promise_already_satisfied,
+    no_state
+  };
+
+  /// Specialization.
+  template<>
+    struct is_error_code_enum<future_errc> : public true_type { };
+
+  /// Points to a statically-allocated object derived from error_category.
+  const error_category&
+  future_category();
+
+  /// Overload for make_error_code.
+  inline error_code 
+  make_error_code(future_errc __errc)
+  { return error_code(static_cast<int>(__errc), future_category()); }
+
+  /// Overload for make_error_condition.
+  inline error_condition 
+  make_error_condition(future_errc __errc)
+  { return error_condition(static_cast<int>(__errc), future_category()); }
+
+  /**
+   *  @brief Exception type thrown by futures.
+   *  @ingroup exceptions
+   */
+  class future_error : public logic_error
+  {
+    error_code 			_M_code;
+
+  public:
+    explicit future_error(error_code __ec)
+    : logic_error("std::future_error"), _M_code(__ec)
+    { }
+
+    virtual ~future_error() throw();
+
+    virtual const char* 
+    what() const throw();
+
+    const error_code& 
+    code() const throw() { return _M_code; }
+  };
+
+  // Forward declarations.
+  template<typename _Res>
+    class future;
+
+  template<typename _Res>
+    class shared_future;
+
+  template<typename _Res>
+    class atomic_future;
+
+  template<typename _Signature> 
+    class packaged_task;
+
+  template<typename _Res>
+    class promise;
+
+  /// Launch code for futures
+  enum class launch 
+  { 
+    any, 
+    async, 
+    sync 
+  };
+
+  /// Status code for futures
+  enum class future_status 
+  {
+    ready,
+    timeout,
+    deferred
+  };
+
+  template<typename _Fn, typename... _Args>
+    future<typename result_of<_Fn(_Args...)>::type>
+    async(launch __policy, _Fn&& __fn, _Args&&... __args);
+
+  template<typename _FnCheck, typename _Fn, typename... _Args>
+    struct __async_sfinae_helper
+    {
+      typedef future<typename result_of<_Fn(_Args...)>::type> type;
+    };
+
+  template<typename _Fn, typename... _Args>
+    struct __async_sfinae_helper<launch, _Fn, _Args...>
+    { };
+
+  template<typename _Fn, typename... _Args>
+    typename
+    __async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
+    async(_Fn&& __fn, _Args&&... __args);
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
+  && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+
+  /// Base class and enclosing scope.
+  struct __future_base
+  {
+    /// Base class for results.
+    struct _Result_base
+    {
+      exception_ptr		_M_error;
+
+      _Result_base(const _Result_base&) = delete;
+      _Result_base& operator=(const _Result_base&) = delete;
+
+      // _M_destroy() allows derived classes to control deallocation
+      virtual void _M_destroy() = 0;
+
+      struct _Deleter
+      {
+	void operator()(_Result_base* __fr) const { __fr->_M_destroy(); }
+      };
+
+    protected:
+      _Result_base();
+      virtual ~_Result_base();
+    };
+
+    /// Result.
+    template<typename _Res>
+      struct _Result : _Result_base
+      {
+      private:
+	typedef alignment_of<_Res>				__a_of;
+	typedef aligned_storage<sizeof(_Res), __a_of::value>	__align_storage;
+	typedef typename __align_storage::type			__align_type;
+
+	__align_type		_M_storage;
+	bool 			_M_initialized;
+
+      public:
+	_Result() : _M_initialized() { }
+	
+	~_Result()
+	{
+	  if (_M_initialized)
+	    _M_value().~_Res();
+	}
+
+	// Return lvalue, future will add const or rvalue-reference
+	_Res& 
+	_M_value() { return *static_cast<_Res*>(_M_addr()); }
+
+	void
+	_M_set(const _Res& __res)
+	{
+	  ::new (_M_addr()) _Res(__res);
+	  _M_initialized = true;
+	}
+
+	void
+	_M_set(_Res&& __res)
+	{
+	  ::new (_M_addr()) _Res(std::move(__res));
+	  _M_initialized = true;
+	}
+
+      private:
+	void _M_destroy() { delete this; }
+
+	void* _M_addr() { return static_cast<void*>(&_M_storage); }
+    };
+
+    // TODO: use template alias when available
+    /*
+      template<typename _Res>
+      using _Ptr = unique_ptr<_Res, _Result_base::_Deleter>;
+    */
+    /// A unique_ptr based on the instantiating type.
+    template<typename _Res>
+      struct _Ptr
+      {
+	typedef unique_ptr<_Res, _Result_base::_Deleter> type;
+      };
+
+    /// Result_alloc.
+    template<typename _Res, typename _Alloc>
+      struct _Result_alloc : _Result<_Res>, _Alloc
+      {
+        typedef typename _Alloc::template rebind<_Result_alloc>::other
+          __allocator_type;
+
+        explicit
+	_Result_alloc(const _Alloc& __a) : _Result<_Res>(), _Alloc(__a)
+        { }
+	
+      private:
+	void _M_destroy()
+        {
+          __allocator_type __a(*this);
+          __a.destroy(this);
+          __a.deallocate(this, 1);
+        }
+      };
+
+    template<typename _Res, typename _Allocator>
+      static typename _Ptr<_Result_alloc<_Res, _Allocator>>::type
+      _S_allocate_result(const _Allocator& __a)
+      {
+        typedef _Result_alloc<_Res, _Allocator>	__result_type;
+        typename __result_type::__allocator_type __a2(__a);
+        __result_type* __p = __a2.allocate(1);
+        __try
+	{
+          __a2.construct(__p, __a);
+        }
+        __catch(...)
+        {
+          __a2.deallocate(__p, 1);
+          __throw_exception_again;
+        }
+        return typename _Ptr<__result_type>::type(__p);
+      }
+
+
+    /// Base class for state between a promise and one or more
+    /// associated futures.
+    class _State_base
+    {
+      typedef _Ptr<_Result_base>::type _Ptr_type;
+
+      _Ptr_type			_M_result;
+      mutex               	_M_mutex;
+      condition_variable  	_M_cond;
+      atomic_flag         	_M_retrieved;
+      once_flag			_M_once;
+
+    public:
+      _State_base() : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT) { }
+      _State_base(const _State_base&) = delete;
+      _State_base& operator=(const _State_base&) = delete;
+      virtual ~_State_base();
+
+      _Result_base&
+      wait()
+      {
+	_M_run_deferred();
+	unique_lock<mutex> __lock(_M_mutex);
+	if (!_M_ready())
+	  _M_cond.wait(__lock, std::bind<bool>(&_State_base::_M_ready, this));
+	return *_M_result;
+      }
+
+      template<typename _Rep, typename _Period>
+        bool
+        wait_for(const chrono::duration<_Rep, _Period>& __rel)
+        {
+	  unique_lock<mutex> __lock(_M_mutex);
+	  auto __bound = std::bind<bool>(&_State_base::_M_ready, this);
+	  return _M_ready() || _M_cond.wait_for(__lock, __rel, __bound);
+	}
+
+      template<typename _Clock, typename _Duration>
+        bool
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs)
+        {
+	  unique_lock<mutex> __lock(_M_mutex);
+	  auto __bound = std::bind<bool>(&_State_base::_M_ready, this);
+	  return _M_ready() || _M_cond.wait_until(__lock, __abs, __bound);
+	}
+
+      void
+      _M_set_result(function<_Ptr_type()> __res, bool __ignore_failure = false)
+      {
+        bool __set = __ignore_failure;
+        // all calls to this function are serialized,
+        // side-effects of invoking __res only happen once
+        call_once(_M_once, &_State_base::_M_do_set, this, ref(__res),
+            ref(__set));
+        if (!__set)
+          __throw_future_error(int(future_errc::promise_already_satisfied));
+      }
+
+      void
+      _M_break_promise(_Ptr_type __res)
+      {
+	if (static_cast<bool>(__res))
+	  {
+	    error_code __ec(make_error_code(future_errc::broken_promise));
+	    __res->_M_error = copy_exception(future_error(__ec));
+	    {
+	      lock_guard<mutex> __lock(_M_mutex);
+	      _M_result.swap(__res);
+	    }
+	    _M_cond.notify_all();
+	  }
+      }
+
+      // Called when this object is passed to a future.
+      void
+      _M_set_retrieved_flag()
+      {
+	if (_M_retrieved.test_and_set())
+	  __throw_future_error(int(future_errc::future_already_retrieved));
+      }
+
+      template<typename _Res, typename _Arg>
+        struct _Setter;
+
+      // set lvalues
+      template<typename _Res, typename _Arg>
+        struct _Setter<_Res, _Arg&>
+        {
+          // check this is only used by promise<R>::set_value(const R&)
+          // or promise<R>::set_value(R&)
+          static_assert(is_same<_Res, _Arg&>::value  // promise<R&>
+              || is_same<const _Res, _Arg>::value,  // promise<R>
+              "Invalid specialisation");
+
+          typename promise<_Res>::_Ptr_type operator()()
+          {
+            _State_base::_S_check(_M_promise->_M_future);
+            _M_promise->_M_storage->_M_set(_M_arg);
+            return std::move(_M_promise->_M_storage);
+          }
+          promise<_Res>*    _M_promise;
+          _Arg&             _M_arg;
+        };
+
+      // set rvalues
+      template<typename _Res>
+        struct _Setter<_Res, _Res&&>
+        {
+          typename promise<_Res>::_Ptr_type operator()()
+          {
+            _State_base::_S_check(_M_promise->_M_future);
+            _M_promise->_M_storage->_M_set(std::move(_M_arg));
+            return std::move(_M_promise->_M_storage);
+          }
+          promise<_Res>*    _M_promise;
+          _Res&             _M_arg;
+        };
+
+      struct __exception_ptr_tag { };
+
+      // set exceptions
+      template<typename _Res>
+        struct _Setter<_Res, __exception_ptr_tag>
+        {
+          typename promise<_Res>::_Ptr_type operator()()
+          {
+            _State_base::_S_check(_M_promise->_M_future);
+            _M_promise->_M_storage->_M_error = _M_ex;
+            return std::move(_M_promise->_M_storage);
+          }
+
+          promise<_Res>*   _M_promise;
+          exception_ptr&    _M_ex;
+        };
+
+      template<typename _Res, typename _Arg>
+        static _Setter<_Res, _Arg&&>
+        __setter(promise<_Res>* __prom, _Arg&& __arg)
+        {
+          return _Setter<_Res, _Arg&&>{ __prom, __arg };
+        }
+
+      template<typename _Res>
+        static _Setter<_Res, __exception_ptr_tag>
+        __setter(exception_ptr& __ex, promise<_Res>* __prom)
+        {
+          return _Setter<_Res, __exception_ptr_tag>{ __prom, __ex };
+        }
+
+      static _Setter<void, void>
+      __setter(promise<void>* __prom);
+
+      template<typename _Tp>
+        static bool
+        _S_check(const shared_ptr<_Tp>& __p)
+        {
+          if (!static_cast<bool>(__p))
+            __throw_future_error((int)future_errc::no_state);
+        }
+
+    private:
+      void
+      _M_do_set(function<_Ptr_type()>& __f, bool& __set)
+      {
+        _Ptr_type __res = __f();
+        {
+          lock_guard<mutex> __lock(_M_mutex);
+          _M_result.swap(__res);
+        }
+        _M_cond.notify_all();
+        __set = true;
+      }
+
+      bool _M_ready() const { return static_cast<bool>(_M_result); }
+
+      virtual void _M_run_deferred() { }
+    };
+
+    template<typename _Res>
+      class _Deferred_state;
+
+    template<typename _Res>
+      class _Async_state;
+
+    template<typename _Signature>
+      class _Task_state;
+
+    template<typename _StateT, typename _Res = typename _StateT::_Res_type>
+      struct _Task_setter;
+  };
+
+  /// Partial specialization for reference types.
+  template<typename _Res>
+    struct __future_base::_Result<_Res&> : __future_base::_Result_base
+    {
+      _Result() : _M_value_ptr() { }
+
+      void _M_set(_Res& __res) { _M_value_ptr = &__res; }
+
+      _Res& _M_get() { return *_M_value_ptr; }
+
+    private:
+      _Res* 			_M_value_ptr;
+      
+      void _M_destroy() { delete this; }
+    };
+
+  /// Explicit specialization for void.
+  template<>
+    struct __future_base::_Result<void> : __future_base::_Result_base
+    {
+    private:
+      void _M_destroy() { delete this; }
+    };
+
+
+  /// Common implementation for future and shared_future.
+  template<typename _Res>
+    class __basic_future : public __future_base
+    {
+    protected:
+      typedef shared_ptr<_State_base>		__state_type;
+      typedef __future_base::_Result<_Res>&	__result_type;
+
+    private:
+      __state_type 		_M_state;
+
+    public:
+      // Disable copying.
+      __basic_future(const __basic_future&) = delete;
+      __basic_future& operator=(const __basic_future&) = delete;
+
+      bool 
+      valid() const { return static_cast<bool>(_M_state); }
+
+      void 
+      wait() const
+      {
+        _State_base::_S_check(_M_state);
+        _M_state->wait();
+      }
+
+      template<typename _Rep, typename _Period>
+        bool
+        wait_for(const chrono::duration<_Rep, _Period>& __rel) const
+        {
+          _State_base::_S_check(_M_state);
+          return _M_state->wait_for(__rel);
+        }
+
+      template<typename _Clock, typename _Duration>
+        bool
+        wait_until(const chrono::time_point<_Clock, _Duration>& __abs) const
+        {
+          _State_base::_S_check(_M_state);
+          return _M_state->wait_until(__abs);
+        }
+
+    protected:
+      /// Wait for the state to be ready and rethrow any stored exception
+      __result_type
+      _M_get_result()
+      {
+        _State_base::_S_check(_M_state);
+        _Result_base& __res = _M_state->wait();
+        if (!(__res._M_error == 0))
+          rethrow_exception(__res._M_error);
+        return static_cast<__result_type>(__res);
+      }
+
+      void _M_swap(__basic_future& __that)
+      {
+        _M_state.swap(__that._M_state);
+      }
+
+      // Construction of a future by promise::get_future()
+      explicit
+      __basic_future(const __state_type& __state) : _M_state(__state)
+      {
+        _State_base::_S_check(_M_state);
+        _M_state->_M_set_retrieved_flag();
+      }
+
+      // Copy construction from a shared_future
+      explicit
+      __basic_future(const shared_future<_Res>&);
+
+      // Move construction from a shared_future
+      explicit
+      __basic_future(shared_future<_Res>&&);
+
+      // Move construction from a future
+      explicit
+      __basic_future(future<_Res>&&);
+
+      constexpr __basic_future() : _M_state() { }
+
+      struct _Reset
+      {
+        explicit _Reset(__basic_future& __fut) : _M_fut(__fut) { }
+        ~_Reset() { _M_fut._M_state.reset(); }
+        __basic_future& _M_fut;
+      };
+    };
+
+
+  /// Primary template for future.
+  template<typename _Res>
+    class future : public __basic_future<_Res>
+    {
+      friend class promise<_Res>;
+      template<typename> friend class packaged_task;
+      template<typename _Fn, typename... _Args>
+        friend future<typename result_of<_Fn(_Args...)>::type>
+        async(launch, _Fn&&, _Args&&...);
+
+      typedef __basic_future<_Res> _Base_type;
+      typedef typename _Base_type::__state_type __state_type;
+
+      explicit
+      future(const __state_type& __state) : _Base_type(__state) { }
+
+    public:
+      constexpr future() : _Base_type() { }
+
+      /// Move constructor
+      future(future&& __uf) : _Base_type(std::move(__uf)) { }
+
+      // Disable copying
+      future(const future&) = delete;
+      future& operator=(const future&) = delete;
+
+      future& operator=(future&& __fut)
+      {
+        future(std::move(__fut))._M_swap(*this);
+        return *this;
+      }
+
+      /// Retrieving the value
+      _Res
+      get()
+      {
+        typename _Base_type::_Reset __reset(*this);
+        return std::move(this->_M_get_result()._M_value());
+      }
+    };
+ 
+  /// Partial specialization for future<R&>
+  template<typename _Res>
+    class future<_Res&> : public __basic_future<_Res&>
+    {
+      friend class promise<_Res&>;
+      template<typename> friend class packaged_task;
+      template<typename _Fn, typename... _Args>
+        friend future<typename result_of<_Fn(_Args...)>::type>
+        async(launch, _Fn&&, _Args&&...);
+
+      typedef __basic_future<_Res&> _Base_type;
+      typedef typename _Base_type::__state_type __state_type;
+
+      explicit
+      future(const __state_type& __state) : _Base_type(__state) { }
+
+    public:
+      constexpr future() : _Base_type() { }
+
+      /// Move constructor
+      future(future&& __uf) : _Base_type(std::move(__uf)) { }
+
+      // Disable copying
+      future(const future&) = delete;
+      future& operator=(const future&) = delete;
+
+      future& operator=(future&& __fut)
+      {
+        future(std::move(__fut))._M_swap(*this);
+        return *this;
+      }
+
+      /// Retrieving the value
+      _Res& 
+      get()
+      {
+        typename _Base_type::_Reset __reset(*this);
+        return this->_M_get_result()._M_get();
+      }
+    };
+
+  /// Explicit specialization for future<void>
+  template<>
+    class future<void> : public __basic_future<void>
+    {
+      friend class promise<void>;
+      template<typename> friend class packaged_task;
+      template<typename _Fn, typename... _Args>
+        friend future<typename result_of<_Fn(_Args...)>::type>
+        async(launch, _Fn&&, _Args&&...);
+
+      typedef __basic_future<void> _Base_type;
+      typedef typename _Base_type::__state_type __state_type;
+
+      explicit
+      future(const __state_type& __state) : _Base_type(__state) { }
+
+    public:
+      constexpr future() : _Base_type() { }
+
+      /// Move constructor
+      future(future&& __uf) : _Base_type(std::move(__uf)) { }
+
+      // Disable copying
+      future(const future&) = delete;
+      future& operator=(const future&) = delete;
+
+      future& operator=(future&& __fut)
+      {
+        future(std::move(__fut))._M_swap(*this);
+        return *this;
+      }
+
+      /// Retrieving the value
+      void 
+      get()
+      {
+        typename _Base_type::_Reset __reset(*this);
+        this->_M_get_result();
+      }
+    };
+
+
+  /// Primary template for shared_future.
+  template<typename _Res>
+    class shared_future : public __basic_future<_Res>
+    {
+      typedef __basic_future<_Res> _Base_type;
+
+    public:
+      constexpr shared_future() : _Base_type() { }
+
+      /// Copy constructor
+      shared_future(const shared_future& __sf) : _Base_type(__sf) { }
+
+      /// Construct from a future rvalue
+      shared_future(future<_Res>&& __uf)
+      : _Base_type(std::move(__uf))
+      { }
+
+      /// Construct from a shared_future rvalue
+      shared_future(shared_future&& __sf)
+      : _Base_type(std::move(__sf))
+      { }
+
+      shared_future& operator=(const shared_future& __sf)
+      {
+        shared_future(__sf)._M_swap(*this);
+        return *this;
+      }
+
+      shared_future& operator=(shared_future&& __sf)
+      {
+        shared_future(std::move(__sf))._M_swap(*this);
+        return *this;
+      }
+
+      /// Retrieving the value
+      const _Res&
+      get()
+      {
+	typename _Base_type::__result_type __r = this->_M_get_result();
+	_Res& __rs(__r._M_value());
+	return __rs;
+      }
+    };
+ 
+  /// Partial specialization for shared_future<R&>
+  template<typename _Res>
+    class shared_future<_Res&> : public __basic_future<_Res&>
+    {
+      typedef __basic_future<_Res&>           _Base_type;
+
+    public:
+      constexpr shared_future() : _Base_type() { }
+
+      /// Copy constructor
+      shared_future(const shared_future& __sf) : _Base_type(__sf) { }
+
+      /// Construct from a future rvalue
+      shared_future(future<_Res&>&& __uf)
+      : _Base_type(std::move(__uf))
+      { }
+
+      /// Construct from a shared_future rvalue
+      shared_future(shared_future&& __sf)
+      : _Base_type(std::move(__sf))
+      { }
+
+      shared_future& operator=(const shared_future& __sf)
+      {
+        shared_future(__sf)._M_swap(*this);
+        return *this;
+      }
+
+      shared_future& operator=(shared_future&& __sf)
+      {
+        shared_future(std::move(__sf))._M_swap(*this);
+        return *this;
+      }
+
+      /// Retrieving the value
+      _Res& 
+      get() { return this->_M_get_result()._M_get(); }
+    };
+
+  /// Explicit specialization for shared_future<void>
+  template<>
+    class shared_future<void> : public __basic_future<void>
+    {
+      typedef __basic_future<void> _Base_type;
+
+    public:
+      constexpr shared_future() : _Base_type() { }
+
+      /// Copy constructor
+      shared_future(const shared_future& __sf) : _Base_type(__sf) { }
+
+      /// Construct from a future rvalue
+      shared_future(future<void>&& __uf)
+      : _Base_type(std::move(__uf))
+      { }
+
+      /// Construct from a shared_future rvalue
+      shared_future(shared_future&& __sf)
+      : _Base_type(std::move(__sf))
+      { }
+
+      shared_future& operator=(const shared_future& __sf)
+      {
+        shared_future(__sf)._M_swap(*this);
+        return *this;
+      }
+
+      shared_future& operator=(shared_future&& __sf)
+      {
+        shared_future(std::move(__sf))._M_swap(*this);
+        return *this;
+      }
+
+      // Retrieving the value
+      void 
+      get() { this->_M_get_result(); }
+    };
+
+  // Now we can define the protected __basic_future constructors.
+  template<typename _Res>
+    inline __basic_future<_Res>::
+    __basic_future(const shared_future<_Res>& __sf)
+    : _M_state(__sf._M_state)
+    { }
+
+  template<typename _Res>
+    inline __basic_future<_Res>::
+    __basic_future(shared_future<_Res>&& __sf)
+    : _M_state(std::move(__sf._M_state))
+    { }
+
+  template<typename _Res>
+    inline __basic_future<_Res>::
+    __basic_future(future<_Res>&& __uf)
+    : _M_state(std::move(__uf._M_state))
+    { }
+
+
+  /// Primary template for promise
+  template<typename _Res>
+    class promise
+    {
+      typedef __future_base::_State_base 			_State;
+      typedef __future_base::_Result<_Res>			_Res_type;
+      typedef typename __future_base::_Ptr<_Res_type>::type	_Ptr_type;
+      template<typename, typename> friend class _State::_Setter;
+      
+      shared_ptr<_State>                        _M_future;
+      _Ptr_type                                 _M_storage;
+
+    public:
+      promise()
+      : _M_future(std::make_shared<_State>()),
+	_M_storage(new _Res_type())
+      { }
+
+      promise(promise&& __rhs)
+      : _M_future(std::move(__rhs._M_future)),
+	_M_storage(std::move(__rhs._M_storage))
+      { }
+
+      template<typename _Allocator>
+        promise(allocator_arg_t, const _Allocator& __a)
+        : _M_future(std::allocate_shared<_State>(__a)),
+	  _M_storage(__future_base::_S_allocate_result<_Res>(__a))
+        { }
+
+      promise(const promise&) = delete;
+
+      ~promise()
+      {
+        if (static_cast<bool>(_M_future) && !_M_future.unique())
+          _M_future->_M_break_promise(std::move(_M_storage));
+      }
+
+      // Assignment
+      promise&
+      operator=(promise&& __rhs)
+      {
+        promise(std::move(__rhs)).swap(*this);
+        return *this;
+      }
+
+      promise& operator=(const promise&) = delete;
+
+      void
+      swap(promise& __rhs)
+      {
+        _M_future.swap(__rhs._M_future);
+        _M_storage.swap(__rhs._M_storage);
+      }
+
+      // Retrieving the result
+      future<_Res>
+      get_future()
+      { return future<_Res>(_M_future); }
+
+      // Setting the result
+      void
+      set_value(const _Res& __r)
+      {
+        auto __setter = _State::__setter(this, __r);
+        _M_future->_M_set_result(std::move(__setter));
+      }
+
+      void
+      set_value(_Res&& __r)
+      {
+        auto __setter = _State::__setter(this, std::move(__r));
+        _M_future->_M_set_result(std::move(__setter));
+      }
+
+      void
+      set_exception(exception_ptr __p)
+      {
+        auto __setter = _State::__setter(__p, this);
+        _M_future->_M_set_result(std::move(__setter));
+      }
+    };
+
+  template<typename _Res>
+    inline void
+    swap(promise<_Res>& __x, promise<_Res>& __y)
+    { __x.swap(__y); }
+
+  template<typename _Res, typename _Alloc>
+    struct uses_allocator<promise<_Res>, _Alloc>
+    : public true_type { };
+
+
+  /// Partial specialization for promise<R&>
+  template<typename _Res>
+    class promise<_Res&>
+    {
+      typedef __future_base::_State_base			_State;
+      typedef __future_base::_Result<_Res&>			_Res_type;
+      typedef typename __future_base::_Ptr<_Res_type>::type 	_Ptr_type;
+      template<typename, typename> friend class _State::_Setter;
+
+      shared_ptr<_State>                        _M_future;
+      _Ptr_type                                 _M_storage;
+
+    public:
+      promise()
+      : _M_future(std::make_shared<_State>()),
+	_M_storage(new _Res_type())
+      { }
+
+      promise(promise&& __rhs)
+      : _M_future(std::move(__rhs._M_future)), 
+	_M_storage(std::move(__rhs._M_storage))
+      { }
+
+      template<typename _Allocator>
+        promise(allocator_arg_t, const _Allocator& __a)
+        : _M_future(std::allocate_shared<_State>(__a)),
+	  _M_storage(__future_base::_S_allocate_result<_Res&>(__a))
+        { }
+
+      promise(const promise&) = delete;
+
+      ~promise()
+      {
+        if (static_cast<bool>(_M_future) && !_M_future.unique())
+          _M_future->_M_break_promise(std::move(_M_storage));
+      }
+
+      // Assignment
+      promise&
+      operator=(promise&& __rhs)
+      {
+        promise(std::move(__rhs)).swap(*this);
+        return *this;
+      }
+
+      promise& operator=(const promise&) = delete;
+
+      void
+      swap(promise& __rhs)
+      {
+        _M_future.swap(__rhs._M_future);
+        _M_storage.swap(__rhs._M_storage);
+      }
+
+      // Retrieving the result
+      future<_Res&>
+      get_future()
+      { return future<_Res&>(_M_future); }
+
+      // Setting the result
+      void
+      set_value(_Res& __r)
+      {
+        auto __setter = _State::__setter(this, __r);
+        _M_future->_M_set_result(std::move(__setter));
+      }
+
+      void
+      set_exception(exception_ptr __p)
+      {
+        auto __setter = _State::__setter(__p, this);
+        _M_future->_M_set_result(std::move(__setter));
+      }
+    };
+
+  /// Explicit specialization for promise<void>
+  template<>
+    class promise<void>
+    {
+      typedef __future_base::_State_base			_State;
+      typedef __future_base::_Result<void>			_Res_type;
+      typedef typename __future_base::_Ptr<_Res_type>::type 	_Ptr_type;
+      template<typename, typename> friend class _State::_Setter;
+
+      shared_ptr<_State>                        _M_future;
+      _Ptr_type                                 _M_storage;
+
+    public:
+      promise()
+      : _M_future(std::make_shared<_State>()),
+	_M_storage(new _Res_type())
+      { }
+
+      promise(promise&& __rhs)
+      : _M_future(std::move(__rhs._M_future)),
+	_M_storage(std::move(__rhs._M_storage))
+      { }
+
+      template<typename _Allocator>
+        promise(allocator_arg_t, const _Allocator& __a)
+        : _M_future(std::allocate_shared<_State>(__a)),
+	  _M_storage(__future_base::_S_allocate_result<void>(__a))
+        { }
+
+      promise(const promise&) = delete;
+
+      ~promise()
+      {
+        if (static_cast<bool>(_M_future) && !_M_future.unique())
+          _M_future->_M_break_promise(std::move(_M_storage));
+      }
+
+      // Assignment
+      promise&
+      operator=(promise&& __rhs)
+      {
+        promise(std::move(__rhs)).swap(*this);
+        return *this;
+      }
+
+      promise& operator=(const promise&) = delete;
+
+      void
+      swap(promise& __rhs)
+      {
+        _M_future.swap(__rhs._M_future);
+        _M_storage.swap(__rhs._M_storage);
+      }
+
+      // Retrieving the result
+      future<void>
+      get_future()
+      { return future<void>(_M_future); }
+
+      // Setting the result
+      void set_value();
+
+      void
+      set_exception(exception_ptr __p)
+      {
+        auto __setter = _State::__setter(__p, this);
+        _M_future->_M_set_result(std::move(__setter));
+      }
+    };
+
+  // set void
+  template<>
+    struct __future_base::_State_base::_Setter<void, void>
+    {
+      promise<void>::_Ptr_type operator()()
+      {
+        _State_base::_S_check(_M_promise->_M_future);
+        return std::move(_M_promise->_M_storage);
+      }
+
+      promise<void>*    _M_promise;
+    };
+
+  inline __future_base::_State_base::_Setter<void, void>
+  __future_base::_State_base::__setter(promise<void>* __prom)
+  {
+    return _Setter<void, void>{ __prom };
+  }
+
+  inline void
+  promise<void>::set_value()
+  {
+    auto __setter = _State::__setter(this);
+    _M_future->_M_set_result(std::move(__setter));
+  }
+
+
+  template<typename _StateT, typename _Res>
+    struct __future_base::_Task_setter
+    {
+      typename _StateT::_Ptr_type operator()()
+      {
+        __try
+	  {
+	    _M_state->_M_result->_M_set(_M_fn());
+	  }
+	__catch(...)
+	  {
+	    _M_state->_M_result->_M_error = current_exception();
+	  }
+        return std::move(_M_state->_M_result);
+      }
+      _StateT*                  _M_state;
+      std::function<_Res()>     _M_fn;
+    };
+
+  template<typename _StateT>
+    struct __future_base::_Task_setter<_StateT, void>
+    {
+      typename _StateT::_Ptr_type operator()()
+      {
+        __try
+	  {
+	    _M_fn();
+	  }
+	__catch(...)
+	  {
+	    _M_state->_M_result->_M_error = current_exception();
+	  }
+	return std::move(_M_state->_M_result);
+      }
+      _StateT*                  _M_state;
+      std::function<void()>     _M_fn;
+    };
+
+  template<typename _Res, typename... _Args>
+    struct __future_base::_Task_state<_Res(_Args...)> 
+    : __future_base::_State_base
+    {
+      typedef _Res _Res_type;
+
+      _Task_state(std::function<_Res(_Args...)> __task)
+      : _M_result(new _Result<_Res>()), _M_task(std::move(__task))
+      { }
+
+      template<typename _Func, typename _Alloc>
+        _Task_state(_Func&& __task, const _Alloc& __a)
+        : _M_result(_S_allocate_result<_Res>(__a)),
+	  _M_task(allocator_arg, __a, std::move(__task))
+        { }
+
+      void
+      _M_run(_Args... __args)
+      {
+        // bound arguments decay so wrap lvalue references
+        auto __bound = std::bind<_Res>(std::ref(_M_task),
+            _S_maybe_wrap_ref(std::forward<_Args>(__args))...);
+        _Task_setter<_Task_state> __setter{ this, std::move(__bound) };
+        _M_set_result(std::move(__setter));
+      }
+
+      template<typename, typename> friend class _Task_setter;
+      typedef typename __future_base::_Ptr<_Result<_Res>>::type _Ptr_type;
+      _Ptr_type _M_result;
+      std::function<_Res(_Args...)> _M_task;
+
+      template<typename _Tp>
+        static reference_wrapper<_Tp>
+        _S_maybe_wrap_ref(_Tp& __t)
+        { return std::ref(__t); }
+
+      template<typename _Tp>
+        static typename enable_if<!is_lvalue_reference<_Tp>::value,
+                        _Tp>::type&&
+        _S_maybe_wrap_ref(_Tp&& __t)
+        { return std::forward<_Tp>(__t); }
+    };
+
+  /// packaged_task
+  template<typename _Res, typename... _ArgTypes>
+    class packaged_task<_Res(_ArgTypes...)>
+    {
+      typedef __future_base::_Task_state<_Res(_ArgTypes...)>  _State_type;
+      shared_ptr<_State_type>                   _M_state;
+
+    public:
+      typedef _Res result_type;
+
+      // Construction and destruction
+      packaged_task() { }
+
+      template<typename _Fn>
+        explicit
+        packaged_task(const _Fn& __fn)
+        : _M_state(std::make_shared<_State_type>(__fn))
+        { }
+
+      template<typename _Fn>
+        explicit
+        packaged_task(_Fn&& __fn)
+        : _M_state(std::make_shared<_State_type>(std::move(__fn)))
+        { }
+
+      explicit
+      packaged_task(_Res(*__fn)(_ArgTypes...))
+      : _M_state(std::make_shared<_State_type>(__fn))
+      { }
+
+      template<typename _Fn, typename _Allocator>
+        explicit
+        packaged_task(allocator_arg_t __tag, const _Allocator& __a, _Fn __fn)
+        : _M_state(std::allocate_shared<_State_type>(__a, std::move(__fn)))
+        { }
+
+      ~packaged_task()
+      {
+        if (static_cast<bool>(_M_state) && !_M_state.unique())
+          _M_state->_M_break_promise(std::move(_M_state->_M_result));
+      }
+
+      // No copy
+      packaged_task(packaged_task&) = delete;
+      packaged_task& operator=(packaged_task&) = delete;
+
+      // Move support
+      packaged_task(packaged_task&& __other)
+      { this->swap(__other); }
+
+      packaged_task& operator=(packaged_task&& __other)
+      {
+        packaged_task(std::move(__other)).swap(*this);
+        return *this;
+      }
+
+      void
+      swap(packaged_task& __other)
+      { _M_state.swap(__other._M_state); }
+
+      bool
+      valid() const
+      { return static_cast<bool>(_M_state); }
+
+      // Result retrieval
+      future<_Res>
+      get_future()
+      { return future<_Res>(_M_state); }
+
+      // Execution
+      void
+      operator()(_ArgTypes... __args)
+      {
+        __future_base::_State_base::_S_check(_M_state);
+        _M_state->_M_run(std::forward<_ArgTypes>(__args)...);
+      }
+
+      void
+      reset()
+      {
+        __future_base::_State_base::_S_check(_M_state);
+        packaged_task(std::move(_M_state->_M_task)).swap(*this);
+      }
+    };
+
+  /// swap
+  template<typename _Res, typename... _ArgTypes>
+    inline void
+    swap(packaged_task<_Res(_ArgTypes...)>& __x,
+	 packaged_task<_Res(_ArgTypes...)>& __y)
+    { __x.swap(__y); }
+
+  template<typename _Res, typename _Alloc>
+    struct uses_allocator<packaged_task<_Res>, _Alloc>
+    : public true_type { };
+
+
+  template<typename _Res>
+    class __future_base::_Deferred_state : public __future_base::_State_base
+    {
+    public:
+      typedef _Res _Res_type;
+
+      explicit
+      _Deferred_state(std::function<_Res()>&& __fn)
+      : _M_result(new _Result<_Res>()), _M_fn(std::move(__fn))
+      { }
+
+    private:
+      template<typename, typename> friend class _Task_setter;
+      typedef typename __future_base::_Ptr<_Result<_Res>>::type _Ptr_type;
+      _Ptr_type _M_result;
+      std::function<_Res()> _M_fn;
+
+      virtual void
+      _M_run_deferred()
+      {
+        _Task_setter<_Deferred_state> __setter{ this, _M_fn };
+        // safe to call multiple times so ignore failure
+        _M_set_result(std::move(__setter), true);
+      }
+    };
+
+  template<typename _Res>
+    class __future_base::_Async_state : public __future_base::_State_base
+    {
+    public:
+      typedef _Res _Res_type;
+
+      explicit 
+      _Async_state(std::function<_Res()>&& __fn)
+      : _M_result(new _Result<_Res>()), _M_fn(std::move(__fn)),
+	_M_thread(mem_fn(&_Async_state::_M_do_run), this)
+      { }
+
+      ~_Async_state() { _M_thread.join(); }
+
+    private:
+      void _M_do_run()
+      {
+        _Task_setter<_Async_state> __setter{ this, std::move(_M_fn) };
+        _M_set_result(std::move(__setter));
+      }
+
+      template<typename, typename> friend class _Task_setter;
+      typedef typename __future_base::_Ptr<_Result<_Res>>::type _Ptr_type;
+      _Ptr_type _M_result;
+      std::function<_Res()> _M_fn;
+      thread _M_thread;
+    };
+
+  /// async 
+  template<typename _Fn, typename... _Args>
+    future<typename result_of<_Fn(_Args...)>::type>
+    async(launch __policy, _Fn&& __fn, _Args&&... __args)
+    {
+      typedef typename result_of<_Fn(_Args...)>::type result_type;
+      std::shared_ptr<__future_base::_State_base> __state;
+      if (__policy == launch::async)
+	{
+	  typedef typename __future_base::_Async_state<result_type> _State;
+	  __state = std::make_shared<_State>(std::bind<result_type>(
+              std::forward<_Fn>(__fn), std::forward<_Args>(__args)...));
+	}
+      else
+	{
+	  typedef typename __future_base::_Deferred_state<result_type> _State;
+	  __state = std::make_shared<_State>(std::bind<result_type>(
+              std::forward<_Fn>(__fn), std::forward<_Args>(__args)...));
+	}
+      return future<result_type>(__state);
+    }
+
+  /// async, potential overload
+  template<typename _Fn, typename... _Args>
+    inline typename
+    __async_sfinae_helper<typename decay<_Fn>::type, _Fn, _Args...>::type
+    async(_Fn&& __fn, _Args&&... __args)
+    {
+      return async(launch::any, std::forward<_Fn>(__fn),
+		   std::forward<_Args>(__args)...);
+    }
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+       // && _GLIBCXX_ATOMIC_BUILTINS_4
+
+  // @} group futures
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_FUTURE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/initializer_list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/initializer_list
new file mode 100644
index 0000000..1048d44
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/initializer_list
@@ -0,0 +1,102 @@
+// std::initializer_list support -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file initializer_list
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _INITIALIZER_LIST
+#define _INITIALIZER_LIST
+
+#pragma GCC system_header
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+#pragma GCC visibility push(default)
+
+#include <bits/c++config.h>
+
+namespace std
+{
+  /// initializer_list
+  template<class _E>
+    class initializer_list
+    {
+    public:
+      typedef _E 		value_type;
+      typedef const _E& 	reference;
+      typedef const _E& 	const_reference;
+      typedef size_t 		size_type;
+      typedef const _E* 	iterator;
+      typedef const _E* 	const_iterator;
+
+    private:
+      iterator			_M_array;
+      size_type			_M_len;
+
+      // The compiler can call a private constructor.
+      constexpr initializer_list(const_iterator __a, size_type __l)
+      : _M_array(__a), _M_len(__l) { }
+
+    public:
+      constexpr initializer_list() : _M_array(0), _M_len(0) { }
+
+      // Number of elements.
+      constexpr size_type
+      size() { return _M_len; }
+
+      // First element.
+      constexpr const_iterator
+      begin() { return _M_array; }
+
+      // One past the last element.
+      constexpr const_iterator
+      end() { return begin() + size(); }
+  };
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the initilizer_list.
+   *  @param  il  Initializer list.
+   */
+  template<class _Tp>
+    constexpr const _Tp*
+    begin(initializer_list<_Tp> __ils)
+    { return __ils.begin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element
+   *          of the initilizer_list.
+   *  @param  il  Initializer list.
+   */
+  template<class _Tp>
+    constexpr const _Tp*
+    end(initializer_list<_Tp> __ils)
+    { return __ils.end(); }
+}
+
+#pragma GCC visibility pop
+#endif // C++0x
+#endif // _INITIALIZER_LIST
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iomanip b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iomanip
new file mode 100644
index 0000000..91f90e5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iomanip
@@ -0,0 +1,352 @@
+// Standard stream manipulators -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <locale>
+#endif
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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)
+  { return { __mask }; }
+
+  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)
+  { return { __mask }; }
+
+  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)
+  { return { __base }; }
+
+  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)
+    { return { __c }; }
+
+  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)
+  { return { __n }; }
+
+  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)
+  { return { __n }; }
+
+  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; 
+    }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  
+  template<typename _MoneyT>
+    struct _Get_money { _MoneyT& _M_mon; bool _M_intl; };
+
+  /**
+   *  @brief  Extended manipulator for extracting money.
+   *  @param  mon  Either long double or a specialization of @c basic_string.
+   *  @param  intl A bool indicating whether international format 
+   *               is to be used.
+   *
+   *  Sent to a stream object, this manipulator extracts @a mon.
+  */
+  template<typename _MoneyT>
+    inline _Get_money<_MoneyT>
+    get_money(_MoneyT& __mon, bool __intl = false)
+    { return { __mon, __intl }; }
+
+  template<typename _CharT, typename _Traits, typename _MoneyT>
+    basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
+    {
+      typedef istreambuf_iterator<_CharT, _Traits> _Iter;
+      typedef money_get<_CharT, _Iter> _MoneyGet;
+      
+      ios_base::iostate __err = ios_base::goodbit;
+      const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
+
+      __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
+	       __is, __err, __f._M_mon);
+
+      if (ios_base::goodbit != __err)
+	__is.setstate(__err);
+
+      return __is; 
+    }
+
+
+  template<typename _MoneyT>
+    struct _Put_money { const _MoneyT& _M_mon; bool _M_intl; };
+
+  /**
+   *  @brief  Extended manipulator for inserting money.
+   *  @param  mon  Either long double or a specialization of @c basic_string.
+   *  @param  intl A bool indicating whether international format 
+   *               is to be used.
+   *
+   *  Sent to a stream object, this manipulator inserts @a mon.
+  */
+  template<typename _MoneyT>
+    inline _Put_money<_MoneyT>
+    put_money(const _MoneyT& __mon, bool __intl = false)
+    { return { __mon, __intl }; }
+
+  template<typename _CharT, typename _Traits, typename _MoneyT>
+    basic_ostream<_CharT, _Traits>& 
+    operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
+    {
+      typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
+      typedef money_put<_CharT, _Iter> _MoneyPut;
+      
+      const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
+      const _Iter __end = __mp.put(_Iter(__os.rdbuf()), __f._M_intl,
+				   __os, __os.fill(), __f._M_mon);
+
+      if (__end.failed())
+	__os.setstate(ios_base::badbit);
+
+      return __os; 
+    }
+
+#endif
+
+  // 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_VERSION
+} // namespace
+
+#endif /* _GLIBCXX_IOMANIP */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ios b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ios
new file mode 100644
index 0000000..9cf8368
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ios
@@ -0,0 +1,47 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iosfwd b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iosfwd
new file mode 100644
index 0000000..8906a1d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iosfwd
@@ -0,0 +1,212 @@
+// Forwarding declarations -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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., <code>class ostream;</code>) is not valid ISO C++.
+   *
+   *  For more specific declarations, see
+   *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
+   *
+   *  @{
+  */
+  class ios_base;
+
+  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;
+
+
+  /// Base class for @c char streams.
+  typedef basic_ios<char> 		ios; 
+
+  /// Base class for @c char buffers.
+  typedef basic_streambuf<char> 	streambuf;
+
+  /// Base class for @c char input streams.
+  typedef basic_istream<char> 		istream;
+
+  /// Base class for @c char output streams.
+  typedef basic_ostream<char> 		ostream;
+
+  /// Base class for @c char mixed input and output streams.
+  typedef basic_iostream<char> 		iostream;
+
+  /// Class for @c char memory buffers.
+  typedef basic_stringbuf<char> 	stringbuf;
+
+  /// Class for @c char input memory streams.
+  typedef basic_istringstream<char> 	istringstream;
+
+  /// Class for @c char output memory streams.
+  typedef basic_ostringstream<char> 	ostringstream;
+
+  /// Class for @c char mixed input and output memory streams.
+  typedef basic_stringstream<char> 	stringstream;
+
+  /// Class for @c char file buffers.
+  typedef basic_filebuf<char> 		filebuf;
+
+  /// Class for @c char input file streams.
+  typedef basic_ifstream<char> 		ifstream;
+
+  /// Class for @c char output file streams.
+  typedef basic_ofstream<char> 		ofstream;
+
+  /// Class for @c char mixed input and output file streams.
+  typedef basic_fstream<char> 		fstream;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  /// Base class for @c wchar_t streams.
+  typedef basic_ios<wchar_t> 		wios;
+
+  /// Base class for @c wchar_t buffers.
+  typedef basic_streambuf<wchar_t> 	wstreambuf;
+
+  /// Base class for @c wchar_t input streams.
+  typedef basic_istream<wchar_t> 	wistream;
+
+  /// Base class for @c wchar_t output streams.
+  typedef basic_ostream<wchar_t> 	wostream;
+
+  /// Base class for @c wchar_t mixed input and output streams.
+  typedef basic_iostream<wchar_t> 	wiostream;
+
+  /// Class for @c wchar_t memory buffers.
+  typedef basic_stringbuf<wchar_t> 	wstringbuf;
+
+  /// Class for @c wchar_t input memory streams.
+  typedef basic_istringstream<wchar_t> 	wistringstream;
+
+  /// Class for @c wchar_t output memory streams.
+  typedef basic_ostringstream<wchar_t> 	wostringstream;
+
+  /// Class for @c wchar_t mixed input and output memory streams.
+  typedef basic_stringstream<wchar_t> 	wstringstream;
+
+  /// Class for @c wchar_t file buffers.
+  typedef basic_filebuf<wchar_t> 	wfilebuf;
+
+  /// Class for @c wchar_t input file streams.
+  typedef basic_ifstream<wchar_t> 	wifstream;
+
+  /// Class for @c wchar_t output file streams.
+  typedef basic_ofstream<wchar_t> 	wofstream;
+
+  /// Class for @c wchar_t mixed input and output file streams.
+  typedef basic_fstream<wchar_t> 	wfstream;
+#endif
+  /** @}  */
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _GLIBCXX_IOSFWD */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iostream b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iostream
new file mode 100644
index 0000000..7c71ba4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iostream
@@ -0,0 +1,80 @@
+// Standard iostream objects -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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_VERSION
+} // namespace
+
+#endif /* _GLIBCXX_IOSTREAM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/istream b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/istream
new file mode 100644
index 0000000..fb39392
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/istream
@@ -0,0 +1,861 @@
+// Input streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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 include/istream
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_ISTREAM
+#define _GLIBCXX_ISTREAM 1
+
+#pragma GCC system_header
+
+#include <ios>
+#include <ostream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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 
+       *  <code>std::cin >> std::ws</code>. 
+       *  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(&apos;\\n&apos;)).
+      */
+      __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(&apos;\\n&apos;)).
+      */
+      __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(&apos;\\n&apos;)).
+      */
+      __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  This function first clears eofbit.  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  This function first clears eofbit.  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().  At variance with putback, unget and
+       *         seekg, eofbit is not cleared first.
+      */
+      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 first clears eofbit.  It 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 first clears eofbit.  It 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 <em>exception-safe
+   *  prefix and suffix operations,</em> although only prefix actions
+   *  are currently required by the standard.
+  */
+  template<typename _CharT, typename _Traits>
+    class basic_istream<_CharT, _Traits>::sentry
+    {
+      // Data Members.
+      bool _M_ok;
+
+    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 (<em>not okay</em>) 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 (@a 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).
+      */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+#endif
+      operator bool() const
+      { return _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 <em>the number of elements of the largest array of *
+   *  - @c char_type that can store a terminating @c eos.</em>
+   *  - [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);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // [27.7.1.6] Rvalue stream extraction
+  /**
+   *  @brief  Generic extractor for rvalue stream
+   *  @param  is  An input stream.
+   *  @param  x  A reference to the extraction target.
+   *  @return  is
+   *
+   *  This is just a forwarding function to allow extraction from
+   *  rvalue streams since they won't bind to the extractor functions
+   *  that take an lvalue reference.
+  */
+  template<typename _CharT, typename _Traits, typename _Tp>
+    inline basic_istream<_CharT, _Traits>&
+    operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
+    { return (__is >> __x); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#include <bits/istream.tcc>
+
+#endif	/* _GLIBCXX_ISTREAM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iterator b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iterator
new file mode 100644
index 0000000..90152b7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/iterator
@@ -0,0 +1,70 @@
+// <iterator> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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 <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>
+#include <bits/range_access.h>
+
+#endif /* _GLIBCXX_ITERATOR */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/limits b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/limits
new file mode 100644
index 0000000..9a31197
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/limits
@@ -0,0 +1,1632 @@
+// The template and inlines for the numeric_limits classes. -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009, 2010  Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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 14 such types:
+//   * integers
+//         bool							(1)
+//         char, signed char, unsigned char, wchar_t            (4)
+//         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 16 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) * 643L / 2136)
+
+#define __glibcxx_max_digits10(T) \
+  (2 + (T) * 643L / 2136)
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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,    /// Intermediate.
+    round_toward_zero         = 0,     /// To zero.
+    round_to_nearest          = 1,     /// To the nearest representable value.
+    round_toward_infinity     = 2,     /// To infinity.
+    round_toward_neg_infinity = 3      /// To negative infinity.
+  };
+
+  /**
+   *  @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 _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR int digits = 0;
+
+    /** The number of base 10 digits that can be represented without change. */
+    static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    /** The number of base 10 digits required to ensure that values which
+	differ are always differentiated.  */
+    static constexpr int max_digits10 = 0;
+#endif
+
+    /** True if the type is signed.  */
+    static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+
+    /** True if the type is integer.
+     *  Is this supposed to be <em>if the type is integral?</em>  */
+    static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+
+    /** True if the type uses an exact representation. <em>All integer types are
+	exact, but not all exact types are integer.  For example, rational and
+	fixed-exponent representations are exact but not integer.</em>
+	[18.2.1.2]/15  */
+    static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+
+    /** For integer types, specifies the base of the representation.  For
+	floating types, specifies the base of the exponent representation.  */
+    static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+    /** True if the type has a representation for positive infinity.  */
+    static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+
+    /** True if the type has a representation for a quiet (non-signaling)
+	<em>Not a Number</em>.  */
+    static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+
+    /** True if the type has a representation for a signaling
+	<em>Not a Number</em>.  */
+    static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+
+    /** See std::float_denorm_style for more information.  */
+    static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
+
+    /** <em>True if loss of accuracy is detected as a denormalization loss,
+	rather than as an inexact result.</em> [18.2.1.2]/42  */
+    static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+
+    /** <em>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.</em> [18.2.1.2]/54  */
+    static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+    /** True if trapping is implemented for this type.  */
+    static _GLIBCXX_USE_CONSTEXPR bool traps = false;
+
+    /** True if tininess is detected before rounding.  (see IEC 559)  */
+    static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_CONSTEXPR _Tp
+      min() throw() { return static_cast<_Tp>(0); }
+
+      /** The maximum finite value.  */
+      static _GLIBCXX_CONSTEXPR _Tp
+      max() throw() { return static_cast<_Tp>(0); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /** A finite value x such that there is no other finite value y
+       *  where y < x.  */
+      static constexpr _Tp
+      lowest() throw() { return static_cast<_Tp>(0); }
+#endif
+
+      /** The @e machine @e epsilon:  the difference between 1 and the least
+	  value greater than 1 that is representable.  */
+      static _GLIBCXX_CONSTEXPR _Tp
+      epsilon() throw() { return static_cast<_Tp>(0); }
+
+      /** The maximum rounding error measurement (see LIA-1).  */
+      static _GLIBCXX_CONSTEXPR _Tp
+      round_error() throw() { return static_cast<_Tp>(0); }
+
+      /** The representation of positive infinity, if @c has_infinity.  */
+      static _GLIBCXX_CONSTEXPR _Tp
+      infinity() throw()  { return static_cast<_Tp>(0); }
+
+      /** The representation of a quiet <em>Not a Number</em>,
+	  if @c has_quiet_NaN. */
+      static _GLIBCXX_CONSTEXPR _Tp
+      quiet_NaN() throw() { return static_cast<_Tp>(0); }
+
+      /** The representation of a signaling <em>Not a Number</em>, if
+	  @c has_signaling_NaN. */
+      static _GLIBCXX_CONSTEXPR _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 _GLIBCXX_CONSTEXPR _Tp
+      denorm_min() throw() { return static_cast<_Tp>(0); }
+    };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp>
+    struct numeric_limits<const _Tp>
+    : public numeric_limits<_Tp> { };
+
+  template<typename _Tp>
+    struct numeric_limits<volatile _Tp>
+    : public numeric_limits<_Tp> { };
+
+  template<typename _Tp>
+    struct numeric_limits<const volatile _Tp>
+    : public numeric_limits<_Tp> { };
+#endif
+
+  // Now there follow 16 explicit specializations.  Yes, 16.  Make sure
+  // you get the count right. (18 in c++0x mode)
+
+  /// numeric_limits<bool> specialization.
+  template<>
+    struct numeric_limits<bool>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR bool 
+      min() throw() { return false; }
+
+      static _GLIBCXX_CONSTEXPR bool 
+      max() throw()  { return true; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr bool
+      lowest() throw() { return min(); }
+#endif
+      static _GLIBCXX_USE_CONSTEXPR int digits = 1;
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR bool 
+      epsilon() throw() { return false; }
+
+      static _GLIBCXX_CONSTEXPR bool 
+      round_error() throw() { return false; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR bool 
+      infinity() throw() { return false; }
+
+      static _GLIBCXX_CONSTEXPR bool 
+      quiet_NaN() throw() { return false; }
+
+      static _GLIBCXX_CONSTEXPR bool 
+      signaling_NaN() throw() { return false; }
+
+      static _GLIBCXX_CONSTEXPR bool 
+      denorm_min() throw() { return false; }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<char> specialization.
+  template<>
+    struct numeric_limits<char>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR char 
+      min() throw() { return __glibcxx_min(char); }
+
+      static _GLIBCXX_CONSTEXPR char 
+      max() throw() { return __glibcxx_max(char); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr char 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char);
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR char 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR char 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR 
+      char infinity() throw()  { return char(); }
+
+      static _GLIBCXX_CONSTEXPR char 
+      quiet_NaN() throw() { return char(); }
+
+      static _GLIBCXX_CONSTEXPR char 
+      signaling_NaN() throw() { return char(); }
+
+      static _GLIBCXX_CONSTEXPR char 
+      denorm_min() throw() { return static_cast<char>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<signed char> specialization.
+  template<>
+    struct numeric_limits<signed char>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      min() throw() { return -__SCHAR_MAX__ - 1; }
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      max() throw() { return __SCHAR_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr signed char 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (signed char);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      infinity() throw() { return static_cast<signed char>(0); }
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      quiet_NaN() throw() { return static_cast<signed char>(0); }
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      signaling_NaN() throw() { return static_cast<signed char>(0); }
+
+      static _GLIBCXX_CONSTEXPR signed char 
+      denorm_min() throw() { return static_cast<signed char>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<unsigned char> specialization.
+  template<>
+    struct numeric_limits<unsigned char>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      min() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      max() throw() { return __SCHAR_MAX__ * 2U + 1; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr unsigned char 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (unsigned char);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (unsigned char);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      infinity() throw() { return static_cast<unsigned char>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      quiet_NaN() throw() { return static_cast<unsigned char>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      signaling_NaN() throw() { return static_cast<unsigned char>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned char 
+      denorm_min() throw() { return static_cast<unsigned char>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<wchar_t> specialization.
+  template<>
+    struct numeric_limits<wchar_t>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      min() throw() { return __glibcxx_min (wchar_t); }
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      max() throw()  { return __glibcxx_max (wchar_t); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr wchar_t 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (wchar_t);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t);
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      infinity() throw() { return wchar_t(); }
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      quiet_NaN() throw() { return wchar_t(); }
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      signaling_NaN() throw() { return wchar_t(); }
+
+      static _GLIBCXX_CONSTEXPR wchar_t 
+      denorm_min() throw() { return wchar_t(); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  /// numeric_limits<char16_t> specialization.
+  template<>
+    struct numeric_limits<char16_t>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      min() throw() { return __glibcxx_min (char16_t); }
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      max() throw() { return __glibcxx_max (char16_t); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr char16_t 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (char16_t);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (char16_t);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed 
+       = __glibcxx_signed (char16_t);
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      infinity() throw()  { return char16_t(); }
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      quiet_NaN() throw() { return char16_t(); }
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      signaling_NaN() throw() { return char16_t(); }
+
+      static _GLIBCXX_CONSTEXPR char16_t 
+      denorm_min() throw() { return char16_t(); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<char32_t> specialization.
+  template<>
+    struct numeric_limits<char32_t>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      min() throw() { return __glibcxx_min (char32_t); }
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      max() throw() { return __glibcxx_max (char32_t); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr char32_t 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char32_t);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (char32_t);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed 
+       = __glibcxx_signed (char32_t);
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      infinity() throw() { return char32_t(); }
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      quiet_NaN() throw() { return char32_t(); }
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      signaling_NaN() throw() { return char32_t(); }
+
+      static _GLIBCXX_CONSTEXPR char32_t 
+      denorm_min() throw() { return char32_t(); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+#endif
+
+  /// numeric_limits<short> specialization.
+  template<>
+    struct numeric_limits<short>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR short 
+      min() throw() { return -__SHRT_MAX__ - 1; }
+
+      static _GLIBCXX_CONSTEXPR short 
+      max() throw() { return __SHRT_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr short 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR short 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR short 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR short 
+      infinity() throw() { return short(); }
+
+      static _GLIBCXX_CONSTEXPR short 
+      quiet_NaN() throw() { return short(); }
+
+      static _GLIBCXX_CONSTEXPR short 
+      signaling_NaN() throw() { return short(); }
+
+      static _GLIBCXX_CONSTEXPR short 
+      denorm_min() throw() { return short(); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<unsigned short> specialization.
+  template<>
+    struct numeric_limits<unsigned short>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      min() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      max() throw() { return __SHRT_MAX__ * 2U + 1; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr unsigned short 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (unsigned short);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (unsigned short);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      infinity() throw() { return static_cast<unsigned short>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      quiet_NaN() throw() { return static_cast<unsigned short>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      signaling_NaN() throw() { return static_cast<unsigned short>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned short 
+      denorm_min() throw() { return static_cast<unsigned short>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<int> specialization.
+  template<>
+    struct numeric_limits<int>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR int 
+      min() throw() { return -__INT_MAX__ - 1; }
+
+      static _GLIBCXX_CONSTEXPR int 
+      max() throw() { return __INT_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR int 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR int 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR int 
+      infinity() throw() { return static_cast<int>(0); }
+
+      static _GLIBCXX_CONSTEXPR int 
+      quiet_NaN() throw() { return static_cast<int>(0); }
+
+      static _GLIBCXX_CONSTEXPR int 
+      signaling_NaN() throw() { return static_cast<int>(0); }
+
+      static _GLIBCXX_CONSTEXPR int 
+      denorm_min() throw() { return static_cast<int>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<unsigned int> specialization.
+  template<>
+    struct numeric_limits<unsigned int>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      min() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      max() throw() { return __INT_MAX__ * 2U + 1; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr unsigned int 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (unsigned int);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (unsigned int);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      infinity() throw() { return static_cast<unsigned int>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      quiet_NaN() throw() { return static_cast<unsigned int>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      signaling_NaN() throw() { return static_cast<unsigned int>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned int 
+      denorm_min() throw() { return static_cast<unsigned int>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<long> specialization.
+  template<>
+    struct numeric_limits<long>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR long
+      min() throw() { return -__LONG_MAX__ - 1; }
+
+      static _GLIBCXX_CONSTEXPR long 
+      max() throw() { return __LONG_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr long 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR long 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR long 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR long 
+      infinity() throw() { return static_cast<long>(0); }
+
+      static _GLIBCXX_CONSTEXPR long 
+      quiet_NaN() throw() { return static_cast<long>(0); }
+
+      static _GLIBCXX_CONSTEXPR long 
+      signaling_NaN() throw() { return static_cast<long>(0); }
+
+      static _GLIBCXX_CONSTEXPR long 
+      denorm_min() throw() { return static_cast<long>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<unsigned long> specialization.
+  template<>
+    struct numeric_limits<unsigned long>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      min() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      max() throw() { return __LONG_MAX__ * 2UL + 1; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr unsigned long 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (unsigned long);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (unsigned long);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      infinity() throw() { return static_cast<unsigned long>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      quiet_NaN() throw() { return static_cast<unsigned long>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      signaling_NaN() throw() { return static_cast<unsigned long>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned long 
+      denorm_min() throw() { return static_cast<unsigned long>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<long long> specialization.
+  template<>
+    struct numeric_limits<long long>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR long long 
+      min() throw() { return -__LONG_LONG_MAX__ - 1; }
+
+      static _GLIBCXX_CONSTEXPR long long 
+      max() throw() { return __LONG_LONG_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr long long 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (long long);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (long long);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR long long 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR long long 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR long long 
+      infinity() throw() { return static_cast<long long>(0); }
+
+      static _GLIBCXX_CONSTEXPR long long 
+      quiet_NaN() throw() { return static_cast<long long>(0); }
+
+      static _GLIBCXX_CONSTEXPR long long 
+      signaling_NaN() throw() { return static_cast<long long>(0); }
+
+      static _GLIBCXX_CONSTEXPR long long 
+      denorm_min() throw() { return static_cast<long long>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<unsigned long long> specialization.
+  template<>
+    struct numeric_limits<unsigned long long>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      min() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      max() throw() { return __LONG_LONG_MAX__ * 2ULL + 1; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr unsigned long long 
+      lowest() throw() { return min(); }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits 
+       = __glibcxx_digits (unsigned long long);
+      static _GLIBCXX_USE_CONSTEXPR int digits10 
+       = __glibcxx_digits10 (unsigned long long);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10 = 0;
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
+      static _GLIBCXX_USE_CONSTEXPR int radix = 2;
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      epsilon() throw() { return 0; }
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      round_error() throw() { return 0; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 
+       = denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      infinity() throw() { return static_cast<unsigned long long>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      quiet_NaN() throw() { return static_cast<unsigned long long>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      signaling_NaN() throw() { return static_cast<unsigned long long>(0); }
+
+      static _GLIBCXX_CONSTEXPR unsigned long long 
+      denorm_min() throw() { return static_cast<unsigned long long>(0); }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
+      static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 
+       = round_toward_zero;
+    };
+
+  /// numeric_limits<float> specialization.
+  template<>
+    struct numeric_limits<float>
+    {
+      static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR float 
+      min() throw() { return __FLT_MIN__; }
+
+      static _GLIBCXX_CONSTEXPR float 
+      max() throw() { return __FLT_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr float 
+      lowest() throw() { return -__FLT_MAX__; }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__;
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10
+	 = __glibcxx_max_digits10 (__FLT_MANT_DIG__);
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+      static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
+
+      static _GLIBCXX_CONSTEXPR float 
+      epsilon() throw() { return __FLT_EPSILON__; }
+
+      static _GLIBCXX_CONSTEXPR float 
+      round_error() throw() { return 0.5F; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+	= bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 
+       = __glibcxx_float_has_denorm_loss;
+
+      static _GLIBCXX_CONSTEXPR float 
+      infinity() throw() { return __builtin_huge_valf (); }
+
+      static _GLIBCXX_CONSTEXPR float 
+      quiet_NaN() throw() { return __builtin_nanf (""); }
+
+      static _GLIBCXX_CONSTEXPR float 
+      signaling_NaN() throw() { return __builtin_nansf (""); }
+
+      static _GLIBCXX_CONSTEXPR float 
+      denorm_min() throw() { return __FLT_DENORM_MIN__; }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559
+	= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before 
+       = __glibcxx_float_tinyness_before;
+      static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR double 
+      min() throw()  { return __DBL_MIN__; }
+
+      static _GLIBCXX_CONSTEXPR double 
+      max() throw() { return __DBL_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr double 
+      lowest() throw() { return -__DBL_MAX__; }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__;
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr int max_digits10
+	 = __glibcxx_max_digits10 (__DBL_MANT_DIG__);
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+      static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
+
+      static _GLIBCXX_CONSTEXPR double 
+      epsilon() throw() { return __DBL_EPSILON__; }
+
+      static _GLIBCXX_CONSTEXPR double 
+      round_error() throw() { return 0.5; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+	= bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 
+        = __glibcxx_double_has_denorm_loss;
+
+      static _GLIBCXX_CONSTEXPR double 
+      infinity() throw() { return __builtin_huge_val(); }
+
+      static _GLIBCXX_CONSTEXPR double 
+      quiet_NaN() throw() { return __builtin_nan (""); }
+
+      static _GLIBCXX_CONSTEXPR double 
+      signaling_NaN() throw() { return __builtin_nans (""); }
+
+      static _GLIBCXX_CONSTEXPR double 
+      denorm_min() throw() { return __DBL_DENORM_MIN__; }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559
+	= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before 
+       = __glibcxx_double_tinyness_before;
+      static _GLIBCXX_USE_CONSTEXPR 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 _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
+
+      static _GLIBCXX_CONSTEXPR long double 
+      min() throw() { return __LDBL_MIN__; }
+
+      static _GLIBCXX_CONSTEXPR long double 
+      max() throw() { return __LDBL_MAX__; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static constexpr long double 
+      lowest() throw() { return -__LDBL_MAX__; }
+#endif
+
+      static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__;
+      static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      static _GLIBCXX_USE_CONSTEXPR int max_digits10
+	 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
+#endif
+      static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
+      static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
+      static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
+
+      static _GLIBCXX_CONSTEXPR long double 
+      epsilon() throw() { return __LDBL_EPSILON__; }
+
+      static _GLIBCXX_CONSTEXPR long double 
+      round_error() throw() { return 0.5L; }
+
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__;
+      static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__;
+
+      static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__;
+      static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
+      static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
+      static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
+	= bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
+      static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
+	= __glibcxx_long_double_has_denorm_loss;
+
+      static _GLIBCXX_CONSTEXPR long double 
+      infinity() throw() { return __builtin_huge_vall (); }
+
+      static _GLIBCXX_CONSTEXPR long double 
+      quiet_NaN() throw() { return __builtin_nanl (""); }
+
+      static _GLIBCXX_CONSTEXPR long double 
+      signaling_NaN() throw() { return __builtin_nansl (""); }
+
+      static _GLIBCXX_CONSTEXPR long double 
+      denorm_min() throw() { return __LDBL_DENORM_MIN__; }
+
+      static _GLIBCXX_USE_CONSTEXPR bool is_iec559
+	= has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+      static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
+      static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
+
+      static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps;
+      static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = 
+					 __glibcxx_long_double_tinyness_before;
+      static _GLIBCXX_USE_CONSTEXPR 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_VERSION
+} // namespace
+
+#undef __glibcxx_signed
+#undef __glibcxx_min
+#undef __glibcxx_max
+#undef __glibcxx_digits
+#undef __glibcxx_digits10
+#undef __glibcxx_max_digits10
+
+#endif // _GLIBCXX_NUMERIC_LIMITS
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/list
new file mode 100644
index 0000000..abcba85
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/list
@@ -0,0 +1,76 @@
+// <list> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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/range_access.h>
+#include <bits/stl_list.h>
+#include <bits/list.tcc>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/list>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/list>
+#endif
+
+#endif /* _GLIBCXX_LIST */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/locale b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/locale
new file mode 100644
index 0000000..cfb152a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/locale
@@ -0,0 +1,45 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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 include/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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/map
new file mode 100644
index 0000000..b2e3bf5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/map
@@ -0,0 +1,73 @@
+// <map> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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>
+#include <bits/range_access.h>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/map>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/map>
+#endif
+
+#endif /* _GLIBCXX_MAP */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/memory b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/memory
new file mode 100644
index 0000000..791ffe0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/memory
@@ -0,0 +1,91 @@
+// <memory> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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
+
+/**
+ * @defgroup memory Memory
+ * @ingroup utilities
+ *
+ * Components for memory allocation, deallocation, and management.
+ */
+
+/**
+ * @defgroup pointer_abstractions Pointer Abstractions
+ * @ingroup memory
+ *
+ * Smart pointers, etc.
+ */
+
+#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__
+#  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 <type_traits>
+#  include <functional>
+#  include <debug/debug.h>
+#  if _GLIBCXX_USE_DEPRECATED
+#    include <backward/auto_ptr.h>
+#  endif
+#  include <bits/unique_ptr.h>
+#  include <bits/shared_ptr.h>
+#else
+#  include <backward/auto_ptr.h>
+#endif
+
+#endif /* _GLIBCXX_MEMORY */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/mutex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/mutex
new file mode 100644
index 0000000..36f894e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/mutex
@@ -0,0 +1,830 @@
+// <mutex> -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/mutex
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_MUTEX
+#define _GLIBCXX_MUTEX 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <tuple>
+#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 _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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;
+
+#ifdef __GTHREAD_MUTEX_INIT
+    constexpr mutex() : _M_mutex(__GTHREAD_MUTEX_INIT) { }
+#else
+    mutex()
+    {
+      // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+      __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+    }
+
+    ~mutex() { __gthread_mutex_destroy(&_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; }
+  };
+
+#ifndef __GTHREAD_RECURSIVE_MUTEX_INIT
+  // FIXME: gthreads doesn't define __gthread_recursive_mutex_destroy
+  // so we need to obtain a __gthread_mutex_t to destroy
+  class __destroy_recursive_mutex
+  {
+    template<typename _Mx, typename _Rm>
+      static void
+      _S_destroy_win32(_Mx* __mx, _Rm const* __rmx)
+      {
+        __mx->counter = __rmx->counter;
+        __mx->sema = __rmx->sema;
+        __gthread_mutex_destroy(__mx);
+      }
+
+  public:
+    // matches a gthr-win32.h recursive mutex
+    template<typename _Rm>
+      static typename enable_if<sizeof(&_Rm::sema), void>::type
+      _S_destroy(_Rm* __mx)
+      {
+        __gthread_mutex_t __tmp;
+        _S_destroy_win32(&__tmp, __mx);
+      }
+
+    // matches a recursive mutex with a member 'actual'
+    template<typename _Rm>
+      static typename enable_if<sizeof(&_Rm::actual), void>::type
+      _S_destroy(_Rm* __mx)
+      { __gthread_mutex_destroy(&__mx->actual); }
+
+    // matches when there's only one mutex type
+    template<typename _Rm>
+      static
+      typename enable_if<is_same<_Rm, __gthread_mutex_t>::value, void>::type
+      _S_destroy(_Rm* __mx)
+      { __gthread_mutex_destroy(__mx); }
+  };
+#endif
+
+  /// recursive_mutex
+  class recursive_mutex
+  {
+    typedef __gthread_recursive_mutex_t		__native_type;
+    __native_type  _M_mutex;
+
+  public:
+    typedef __native_type* 			native_handle_type;
+
+#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
+    recursive_mutex() : _M_mutex(__GTHREAD_RECURSIVE_MUTEX_INIT) { }
+#else
+    recursive_mutex()
+    {
+      // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+      __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+    }
+
+    ~recursive_mutex()
+    { __destroy_recursive_mutex::_S_destroy(&_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;
+
+#ifdef __GTHREAD_MUTEX_INIT
+    timed_mutex() : _M_mutex(__GTHREAD_MUTEX_INIT) { }
+#else
+    timed_mutex()
+    {
+      __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+    }
+
+    ~timed_mutex() { __gthread_mutex_destroy(&_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;
+
+#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
+    recursive_timed_mutex() : _M_mutex(__GTHREAD_RECURSIVE_MUTEX_INIT) { }
+#else
+    recursive_timed_mutex()
+    {
+      // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+      __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+    }
+
+    ~recursive_timed_mutex()
+    { __destroy_recursive_mutex::_S_destroy(&_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 { };
+
+  constexpr defer_lock_t	defer_lock { };
+  constexpr try_to_lock_t	try_to_lock { };
+  constexpr adopt_lock_t	adopt_lock { };
+
+  /// @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) : _M_device(__m)
+      { } // calling thread owns mutex
+
+      ~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<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<typename _Lock>
+    unique_lock<_Lock>
+    __try_to_lock(_Lock& __l)
+    { return unique_lock<_Lock>(__l, try_to_lock); }
+
+  template<int _Idx, bool _Continue = true>
+    struct __try_lock_impl
+    {
+      template<typename... _Lock>
+	static void
+	__do_try_lock(tuple<_Lock&...>& __locks, int& __idx)
+	{
+          __idx = _Idx;
+          auto __lock = __try_to_lock(std::get<_Idx>(__locks));
+          if (__lock.owns_lock())
+            {
+              __try_lock_impl<_Idx + 1, _Idx + 2 < sizeof...(_Lock)>::
+                __do_try_lock(__locks, __idx);
+              if (__idx == -1)
+                __lock.release();
+            }
+	}
+    };
+
+  template<int _Idx>
+    struct __try_lock_impl<_Idx, false>
+    {
+      template<typename... _Lock>
+	static void
+	__do_try_lock(tuple<_Lock&...>& __locks, int& __idx)
+	{
+          __idx = _Idx;
+          auto __lock = __try_to_lock(std::get<_Idx>(__locks));
+          if (__lock.owns_lock())
+            {
+              __idx = -1;
+              __lock.release();
+            }
+	}
+    };
+
+  /** @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)
+    {
+      int __idx;
+      auto __locks = std::tie(__l1, __l2, __l3...);
+      __try
+      { __try_lock_impl<0>::__do_try_lock(__locks, __idx); }
+      __catch(...)
+      { }
+      return __idx;
+    }
+
+  /** @brief Generic 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).
+   *  @throw An exception thrown by an argument's lock() or try_lock() member.
+   *  @post All arguments are locked.
+   *
+   *  All arguments are locked via a sequence of calls to lock(), try_lock()
+   *  and unlock().  If the call exits via an exception any locks that were
+   *  obtained will be released.
+   */
+  template<typename _L1, typename _L2, typename ..._L3>
+    void
+    lock(_L1& __l1, _L2& __l2, _L3&... __l3)
+    {
+      while (true)
+        {
+          unique_lock<_L1> __first(__l1);
+          int __idx;
+          auto __locks = std::tie(__l2, __l3...);
+          __try_lock_impl<0, sizeof...(_L3)>::__do_try_lock(__locks, __idx);
+          if (__idx == -1)
+            {
+              __first.release();
+              return;
+            }
+        }
+    }
+
+  /// once_flag
+  struct once_flag
+  {
+  private:
+    typedef __gthread_once_t __native_type;
+    __native_type  _M_once;
+
+  public:
+    constexpr once_flag() : _M_once(__GTHREAD_ONCE_INIT) { }
+
+    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 void
+  __set_once_functor_lock_ptr(unique_lock<mutex>*);
+
+  extern mutex&
+  __get_once_mutex();
+#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 = std::bind<void>(std::forward<_Callable>(__f),
+          std::forward<_Args>(__args)...);
+      __once_callable = &__bound_functor;
+      __once_call = &__once_call_impl<decltype(__bound_functor)>;
+#else
+      unique_lock<mutex> __functor_lock(__get_once_mutex());
+      __once_functor = std::bind<void>(std::forward<_Callable>(__f),
+          std::forward<_Args>(__args)...);
+      __set_once_functor_lock_ptr(&__functor_lock);
+#endif
+
+      int __e = __gthread_once(&(__once._M_once), &__once_proxy);
+
+#ifndef _GLIBCXX_HAVE_TLS
+      if (__functor_lock)
+        __set_once_functor_lock_ptr(0);
+#endif
+
+      if (__e)
+	__throw_system_error(__e);
+    }
+
+  // @} group mutexes
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_MUTEX
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/new b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/new
new file mode 100644
index 0000000..7f7fdb8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/new
@@ -0,0 +1,115 @@
+// The -*- C++ -*- dynamic memory management header.
+
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
+
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+// 
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file new
+ *  This is a Standard C++ Library header.
+ *
+ *  The header @c new defines several functions to manage dynamic memory and
+ *  handling memory allocation errors; see
+ *  http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more.
+ */
+
+#ifndef _NEW
+#define _NEW
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <exception>
+
+#pragma GCC visibility push(default)
+
+extern "C++" {
+
+namespace std 
+{
+  /**
+   *  @brief  Exception possibly thrown by @c new.
+   *  @ingroup exceptions
+   *
+   *  @c bad_alloc (or classes derived from it) is used to report allocation
+   *  errors from the throwing forms of @c new.  */
+  class bad_alloc : public exception 
+  {
+  public:
+    bad_alloc() throw() { }
+
+    // This declaration is not useless:
+    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
+    virtual ~bad_alloc() throw();
+
+    // See comment in eh_exception.cc.
+    virtual const char* what() const throw();
+  };
+
+  struct nothrow_t { };
+
+  extern const nothrow_t nothrow;
+
+  /** If you write your own error handler to be called by @c new, it must
+   *  be of this type.  */
+  typedef void (*new_handler)();
+
+  /// Takes a replacement handler as the argument, returns the
+  /// previous handler.
+  new_handler set_new_handler(new_handler) throw();
+} // namespace std
+
+//@{
+/** These are replaceable signatures:
+ *  - normal single new and delete (no arguments, throw @c bad_alloc on error)
+ *  - normal array new and delete (same)
+ *  - @c nothrow single new and delete (take a @c nothrow argument, return
+ *    @c NULL on error)
+ *  - @c nothrow array new and delete (same)
+ *
+ *  Placement new and delete signatures (take a memory address argument,
+ *  does nothing) may not be replaced by a user's program.
+*/
+void* operator new(std::size_t) throw (std::bad_alloc);
+void* operator new[](std::size_t) throw (std::bad_alloc);
+void operator delete(void*) throw();
+void operator delete(void*, std::size_t) throw();
+void operator delete[](void*) throw();
+void* operator new(std::size_t, const std::nothrow_t&) throw();
+void* operator new[](std::size_t, const std::nothrow_t&) throw();
+void operator delete(void*, const std::nothrow_t&) throw();
+void operator delete[](void*, const std::nothrow_t&) throw();
+
+// Default placement versions of operator new.
+inline void* operator new(std::size_t, void* __p) throw() { return __p; }
+inline void* operator new[](std::size_t, void* __p) throw() { return __p; }
+
+// Default placement versions of operator delete.
+inline void  operator delete  (void*, void*) throw() { }
+inline void  operator delete[](void*, void*) throw() { }
+//@}
+} // extern "C++"
+
+#pragma GCC visibility pop
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/numeric b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/numeric
new file mode 100644
index 0000000..1acedf4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/numeric
@@ -0,0 +1,77 @@
+// <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 <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/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ostream b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ostream
new file mode 100644
index 0000000..3004d4b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ostream
@@ -0,0 +1,590 @@
+// Output streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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 <em>exception-safe prefix and
+   *  suffix operations</em>.
+  */
+  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 (@a 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).
+      */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+#endif
+      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++/manual/bk01pt11ch25s02.html
+   *  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.
+   *
+   *  <em>Null character</em> 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(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // [27.7.2.9] Rvalue stream insertion
+  /**
+   *  @brief  Generic inserter for rvalue stream
+   *  @param  os  An input stream.
+   *  @param  x  A reference to the object being inserted.
+   *  @return  os
+   *
+   *  This is just a forwarding function to allow insertion to
+   *  rvalue streams since they won't bind to the inserter functions
+   *  that take an lvalue reference.
+  */
+  template<typename _CharT, typename _Traits, typename _Tp>
+    inline basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
+    { return (__os << __x); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#include <bits/ostream.tcc>
+
+#endif	/* _GLIBCXX_OSTREAM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/base.h
new file mode 100644
index 0000000..ef17443
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/base.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/base.h
+ *  @brief Sequential helper functions.
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+// Written by Lixia Liu
+
+#ifndef _GLIBCXX_PROFILE_BASE_H
+#define _GLIBCXX_PROFILE_BASE_H 1
+
+#include <functional>
+#include <profile/impl/profiler.h>
+
+// Profiling mode namespaces.
+
+/**
+ * @namespace std::__profile
+ * @brief GNU profile code, replaces standard behavior with profile behavior.
+ */
+namespace std _GLIBCXX_VISIBILITY(default) 
+{ 
+  namespace __profile { } 
+}
+
+/**
+ * @namespace __gnu_profile
+ * @brief GNU profile code for public use.
+ */
+namespace __gnu_profile
+{
+  // Import all the profile versions of components in namespace std.
+  using namespace std::__profile;
+}
+
+
+#endif /* _GLIBCXX_PROFILE_BASE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/bitset b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/bitset
new file mode 100644
index 0000000..381f1ea
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/bitset
@@ -0,0 +1,377 @@
+// Profiling bitset implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/bitset
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_BITSET
+#define _GLIBCXX_PROFILE_BITSET
+
+#include <bitset>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::bitset wrapper with performance instrumentation.
+  template<size_t _Nb>
+    class bitset
+    : public _GLIBCXX_STD_C::bitset<_Nb>
+    {
+      typedef _GLIBCXX_STD_C::bitset<_Nb> _Base;
+
+    public:
+      // bit reference:
+      class reference
+      : private _Base::reference
+      {
+	typedef typename _Base::reference _Base_ref;
+
+	friend class bitset;
+	reference();
+
+	reference(const _Base_ref& __base, bitset* __seq)
+	: _Base_ref(__base)
+	{ }
+
+      public:
+	reference(const reference& __x)
+	: _Base_ref(__x)
+	{ }
+
+	reference&
+	operator=(bool __x)
+	{
+	  *static_cast<_Base_ref*>(this) = __x;
+	  return *this;
+	}
+
+	reference&
+	operator=(const reference& __x)
+	{
+	  *static_cast<_Base_ref*>(this) = __x;
+	  return *this;
+	}
+
+	bool
+	operator~() const
+	{
+	  return ~(*static_cast<const _Base_ref*>(this));
+	}
+
+	operator bool() const
+	{
+	  return *static_cast<const _Base_ref*>(this);
+	}
+
+	reference&
+	flip()
+	{
+	  _Base_ref::flip();
+	  return *this;
+	}
+      };
+
+      // 23.3.5.1 constructors:
+      _GLIBCXX_CONSTEXPR bitset() : _Base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      constexpr bitset(unsigned long long __val)
+#else
+      bitset(unsigned long __val)
+#endif
+      : _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) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _CharT>
+        explicit
+        bitset(const _CharT* __str,
+	       typename std::basic_string<_CharT>::size_type __n
+	       = std::basic_string<_CharT>::npos,
+	       _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
+	: _Base(__str, __n, __zero, __one) { }
+#endif
+
+      // 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)
+      {
+	return reference(_M_base()[__pos], this);
+      }
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 11. Bitset minor problems
+      bool
+      operator[](size_t __pos) const
+      {
+	return _M_base()[__pos];
+      }
+
+      using _Base::to_ulong;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::to_ullong;
+#endif
+
+      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 __profile
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // DR 1182.
+  /// std::hash specialization for bitset.
+  template<size_t _Nb>
+    struct hash<__profile::bitset<_Nb>>
+    : public __hash_base<size_t, __profile::bitset<_Nb>>
+    {
+      size_t
+      operator()(const __profile::bitset<_Nb>& __b) const noexcept
+      { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); }
+    };
+#endif
+
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/deque b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/deque
new file mode 100644
index 0000000..1c0e53c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/deque
@@ -0,0 +1,451 @@
+// Profiling deque implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/deque
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_DEQUE
+#define _GLIBCXX_PROFILE_DEQUE 1
+
+#include <deque>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::deque wrapper with performance instrumentation.
+  template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+    class deque
+    : public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
+    {
+      typedef  _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
+
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef typename _Base::iterator             iterator;
+      typedef typename _Base::const_iterator       const_iterator;
+      typedef typename _Base::reverse_iterator     reverse_iterator;
+      typedef typename _Base::const_reverse_iterator const_reverse_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;
+
+      // 23.2.1.1 construct/copy/destroy:
+      explicit
+      deque(const _Allocator& __a = _Allocator())
+      : _Base(__a) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+      deque(size_type __n)
+      : _Base(__n) { }
+
+      deque(size_type __n, const _Tp& __value,
+	    const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) { }
+#else
+      explicit
+      deque(size_type __n, const _Tp& __value = _Tp(),
+	    const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) { }
+#endif
+
+      template<class _InputIterator>
+        deque(_InputIterator __first, _InputIterator __last,
+	      const _Allocator& __a = _Allocator())
+	: _Base(__first, __last, __a)
+        { }
+
+      deque(const deque& __x)
+      : _Base(__x) { }
+
+      deque(const _Base& __x)
+      : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      deque(deque&& __x)
+      : _Base(std::move(__x))
+      { }
+
+      deque(initializer_list<value_type> __l,
+	    const allocator_type& __a = allocator_type())
+      : _Base(__l, __a) { }
+#endif
+
+      ~deque() { }
+
+      deque&
+      operator=(const deque& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      deque&
+      operator=(deque&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      deque&
+      operator=(initializer_list<value_type> __l)
+      {
+	*static_cast<_Base*>(this) = __l;
+	return *this;
+      }
+#endif
+
+      template<class _InputIterator>
+        void
+        assign(_InputIterator __first, _InputIterator __last)
+        {
+	  _Base::assign(__first, __last);
+	}
+
+      void
+      assign(size_type __n, const _Tp& __t)
+      {
+	_Base::assign(__n, __t);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      assign(initializer_list<value_type> __l)
+      {
+	_Base::assign(__l);
+      }
+#endif
+
+      using _Base::get_allocator;
+
+      // iterators:
+      iterator
+      begin()
+      { return iterator(_Base::begin()); }
+
+      const_iterator
+      begin() const
+      { return const_iterator(_Base::begin()); }
+
+      iterator
+      end()
+      { return iterator(_Base::end()); }
+
+      const_iterator
+      end() const
+      { return const_iterator(_Base::end()); }
+
+      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()); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_Base::end()); }
+
+      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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      resize(size_type __sz)
+      {
+	_Base::resize(__sz);
+      }
+
+      void
+      resize(size_type __sz, const _Tp& __c)
+      {
+	_Base::resize(__sz, __c);
+      }
+#else
+      void
+      resize(size_type __sz, _Tp __c = _Tp())
+      {
+	_Base::resize(__sz, __c);
+      }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::shrink_to_fit;
+#endif
+
+      using _Base::empty;
+
+      // element access:
+      reference
+      operator[](size_type __n)
+      {
+	return _M_base()[__n];
+      }
+
+      const_reference
+      operator[](size_type __n) const
+      {
+	return _M_base()[__n];
+      }
+
+      using _Base::at;
+
+      reference
+      front()
+      {
+	return _Base::front();
+      }
+
+      const_reference
+      front() const
+      {
+	return _Base::front();
+      }
+
+      reference
+      back()
+      {
+	return _Base::back();
+      }
+
+      const_reference
+      back() const
+      {
+	return _Base::back();
+      }
+
+      // 23.2.1.3 modifiers:
+      void
+      push_front(const _Tp& __x)
+      {
+	_Base::push_front(__x);
+      }
+
+      void
+      push_back(const _Tp& __x)
+      {
+	_Base::push_back(__x);
+      }
+
+#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)...);
+	}
+
+      template<typename... _Args>
+        void
+        emplace_back(_Args&&... __args)
+	{
+	  _Base::emplace_back(std::forward<_Args>(__args)...);
+	}
+
+      template<typename... _Args>
+        iterator
+        emplace(iterator __position, _Args&&... __args)
+	{
+	  typename _Base::iterator __res = _Base::emplace(__position,
+					    std::forward<_Args>(__args)...);
+	  return iterator(__res);
+	}
+#endif
+
+      iterator
+      insert(iterator __position, const _Tp& __x)
+      {
+	typename _Base::iterator __res = _Base::insert(__position, __x);
+	return iterator(__res);
+      }
+
+#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);
+      }
+#endif
+
+      void
+      insert(iterator __position, size_type __n, const _Tp& __x)
+      {
+	_Base::insert(__position, __n, __x);
+      }
+
+      template<class _InputIterator>
+        void
+        insert(iterator __position,
+	       _InputIterator __first, _InputIterator __last)
+        {
+	  _Base::insert(__position, __first, __last);
+	}
+
+      void
+      pop_front()
+      {
+	_Base::pop_front();
+      }
+
+      void
+      pop_back()
+      {
+	_Base::pop_back();
+      }
+
+      iterator
+      erase(iterator __position)
+      {
+	if (__position == begin() || __position == end()-1)
+	  {
+	    return iterator(_Base::erase(__position));
+	  }
+	else
+	  {
+	    typename _Base::iterator __res = _Base::erase(__position);
+	    return iterator(__res);
+	  }
+      }
+
+      iterator
+      erase(iterator __first, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+        return iterator(_Base::erase(__first, __last));
+      }
+
+      void
+      swap(deque& __x)
+      {
+	_Base::swap(__x);
+      }
+
+      void
+      clear()
+      {
+	_Base::clear();
+      }
+
+      _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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/forward_list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/forward_list
new file mode 100644
index 0000000..00af855
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/forward_list
@@ -0,0 +1,179 @@
+// <forward_list> -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/forward_list
+ *  This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_FORWARD_LIST
+#define _GLIBCXX_PROFILE_FORWARD_LIST 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <forward_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::forward_list wrapper with performance instrumentation.
+  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+    class forward_list
+    : public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc>
+    {
+      typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base;
+
+    public:
+      typedef typename _Base::size_type             size_type;
+
+    public:
+      // 23.2.3.1 construct/copy/destroy:
+      explicit
+      forward_list(const _Alloc& __al = _Alloc())
+      : _Base(__al) { }
+
+      forward_list(const forward_list& __list, const _Alloc& __al)
+      : _Base(__list, __al)
+      { }
+
+      forward_list(forward_list&& __list, const _Alloc& __al)
+      : _Base(std::move(__list), __al)
+      { }
+
+      explicit
+      forward_list(size_type __n)
+      : _Base(__n)
+      { }
+
+      forward_list(size_type __n, const _Tp& __value,
+                   const _Alloc& __al = _Alloc())
+      : _Base(__n, __value, __al)
+      { }
+
+      template<typename _InputIterator>
+        forward_list(_InputIterator __first, _InputIterator __last,
+                     const _Alloc& __al = _Alloc())
+        : _Base(__first, __last, __al)
+        { }
+
+      forward_list(const forward_list& __list)
+      : _Base(__list)
+      { }
+
+      forward_list(forward_list&& __list)
+      : _Base(std::move(__list)) { }
+
+      forward_list(std::initializer_list<_Tp> __il,
+                   const _Alloc& __al = _Alloc())
+      : _Base(__il, __al)
+      { }
+
+      ~forward_list()
+      { }
+
+      forward_list&
+      operator=(const forward_list& __list)
+      {
+	static_cast<_Base&>(*this) = __list;
+	return *this;
+      }
+
+      forward_list&
+      operator=(forward_list&& __list)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	_Base::clear();
+	_Base::swap(__list);
+	return *this;
+      }
+
+      forward_list&
+      operator=(std::initializer_list<_Tp> __il)
+      {
+	static_cast<_Base&>(*this) = __il;
+        return *this;
+      }
+
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+    };
+
+  template<typename _Tp, typename _Alloc>
+    inline bool
+    operator==(const forward_list<_Tp, _Alloc>& __lx,
+               const forward_list<_Tp, _Alloc>& __ly)
+    { return __lx._M_base() == __ly._M_base(); }
+
+  template<typename _Tp, typename _Alloc>
+    inline bool
+    operator<(const forward_list<_Tp, _Alloc>& __lx,
+              const forward_list<_Tp, _Alloc>& __ly)
+    { return __lx._M_base() < __ly._M_base(); }
+
+  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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler.h
new file mode 100644
index 0000000..ab9cd90
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler.h
@@ -0,0 +1,409 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler.h
+ *  @brief Interface of the profiling runtime library.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_H
+#define _GLIBCXX_PROFILE_PROFILER_H 1
+
+#include <bits/c++config.h>
+
+// Mechanism to define data with inline linkage.
+#define _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__type, __name)             \
+  inline __type&                                                        \
+  __get_##__name()                                                      \
+  {                                                                     \
+    static __type __name;                                               \
+    return __name;                                                      \
+  }
+#define _GLIBCXX_PROFILE_DEFINE_DATA(__type, __name, __initial_value...) \
+  inline __type& __get_##__name() {                                      \
+    static __type __name(__initial_value);                               \
+    return __name;                                                       \
+  }
+#define _GLIBCXX_PROFILE_DATA(__name) \
+  __get_##__name()
+
+namespace __gnu_profile
+{
+  /** @brief Reentrance guard.
+   *
+   * Mechanism to protect all __gnu_profile operations against recursion,
+   * multithreaded and exception reentrance.
+   */
+  struct __reentrance_guard
+  {
+    static bool
+    __get_in()
+    {
+      if (__inside() == true)
+	return false;
+      else
+	{
+	  __inside() = true;
+	  return true;
+	}
+    }
+
+    static bool&
+    __inside()
+    {
+      static __thread bool _S_inside(false);
+      return _S_inside;
+    }
+
+    __reentrance_guard() { }
+    ~__reentrance_guard() { __inside() = false; }
+  };
+
+#define _GLIBCXX_PROFILE_REENTRANCE_GUARD(__x...)	      	\
+  {                                                             \
+    if (__gnu_profile::__reentrance_guard::__get_in())          \
+    {                                                           \
+      __gnu_profile::__reentrance_guard __get_out; 		\
+      __x;                                                      \
+    }                                                           \
+  }
+
+  // Forward declarations of implementation functions.
+  // Don't use any __gnu_profile:: in user code.
+  // Instead, use the __profcxx... macros, which offer guarded access.
+  bool __turn_on();
+  bool __turn_off();
+  bool __is_invalid();
+  bool __is_on();
+  bool __is_off();
+  void __report(void);
+  void __trace_hashtable_size_resize(const void*, std::size_t, std::size_t);
+  void __trace_hashtable_size_destruct(const void*, std::size_t, std::size_t);
+  void __trace_hashtable_size_construct(const void*, std::size_t);
+  void __trace_vector_size_resize(const void*, std::size_t, std::size_t);
+  void __trace_vector_size_destruct(const void*, std::size_t, std::size_t);
+  void __trace_vector_size_construct(const void*, std::size_t);
+  void __trace_hash_func_destruct(const void*, std::size_t, std::size_t,
+				  std::size_t);
+  void __trace_hash_func_construct(const void*);
+  void __trace_vector_to_list_destruct(const void*);
+  void __trace_vector_to_list_construct(const void*);
+  void __trace_vector_to_list_insert(const void*, std::size_t, std::size_t);
+  void __trace_vector_to_list_iterate(const void*, std::size_t);
+  void __trace_vector_to_list_invalid_operator(const void*);
+  void __trace_vector_to_list_resize(const void*, std::size_t, std::size_t);
+  void __trace_vector_to_list_find(const void*, std::size_t);
+
+  void __trace_list_to_slist_destruct(const void*);
+  void __trace_list_to_slist_construct(const void*);
+  void __trace_list_to_slist_rewind(const void*);
+  void __trace_list_to_slist_operation(const void*);
+
+  void __trace_list_to_vector_destruct(const void*);
+  void __trace_list_to_vector_construct(const void*);
+  void __trace_list_to_vector_insert(const void*, std::size_t, std::size_t);
+  void __trace_list_to_vector_iterate(const void*, std::size_t);
+  void __trace_list_to_vector_invalid_operator(const void*);
+  void __trace_list_to_vector_resize(const void*, std::size_t, std::size_t);
+
+  void __trace_list_to_set_destruct(const void*);
+  void __trace_list_to_set_construct(const void*);
+  void __trace_list_to_set_insert(const void*, std::size_t, std::size_t); 
+  void __trace_list_to_set_iterate(const void*, std::size_t);
+  void __trace_list_to_set_invalid_operator(const void*);
+  void __trace_list_to_set_find(const void*, std::size_t); 
+
+  void __trace_map_to_unordered_map_construct(const void*);
+  void __trace_map_to_unordered_map_invalidate(const void*);
+  void __trace_map_to_unordered_map_insert(const void*, std::size_t,
+					   std::size_t);
+  void __trace_map_to_unordered_map_erase(const void*, std::size_t,
+					  std::size_t);
+  void __trace_map_to_unordered_map_iterate(const void*, std::size_t);
+  void __trace_map_to_unordered_map_find(const void*, std::size_t);
+  void __trace_map_to_unordered_map_destruct(const void*);
+} // namespace __gnu_profile
+
+// Master switch turns on all diagnostics that are not explicitly turned off.
+#ifdef _GLIBCXX_PROFILE
+#ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_SMALL
+#define _GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_HASHTABLE_TOO_LARGE
+#define _GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_SMALL
+#define _GLIBCXX_PROFILE_VECTOR_TOO_SMALL
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TOO_LARGE
+#define _GLIBCXX_PROFILE_VECTOR_TOO_LARGE
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_INEFFICIENT_HASH
+#define _GLIBCXX_PROFILE_INEFFICIENT_HASH
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_VECTOR_TO_LIST
+#define _GLIBCXX_PROFILE_VECTOR_TO_LIST
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_LIST_TO_SLIST
+#define _GLIBCXX_PROFILE_LIST_TO_SLIST
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_LIST_TO_VECTOR
+#define _GLIBCXX_PROFILE_LIST_TO_VECTOR
+#endif
+#ifndef _GLIBCXX_PROFILE_NO_MAP_TO_UNORDERED_MAP
+#define _GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP
+#endif
+#endif
+
+// Expose global management routines to user code.
+#ifdef _GLIBCXX_PROFILE
+#define __profcxx_report() \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__report())
+#define __profcxx_turn_on() \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__turn_on())
+#define __profcxx_turn_off() \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__turn_off())
+#define __profcxx_is_invalid() \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_invalid())
+#define __profcxx_is_on() \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_on())
+#define __profcxx__is_off() \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_off())
+#else
+#define __profcxx_report()
+#define __profcxx_turn_on()
+#define __profcxx_turn_off()
+#define __profcxx_is_invalid()
+#define __profcxx_is_on()
+#define __profcxx_is_off()
+#endif
+
+// Turn on/off instrumentation for HASHTABLE_TOO_SMALL and HASHTABLE_TOO_LARGE.
+#if (defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL) \
+     || defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE))
+#define __profcxx_hashtable_resize(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_hashtable_size_resize(__x))
+#define __profcxx_hashtable_destruct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_hashtable_size_destruct(__x))
+#define __profcxx_hashtable_construct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_hashtable_size_construct(__x))
+#else
+#define __profcxx_hashtable_resize(__x...)  
+#define __profcxx_hashtable_destruct(__x...) 
+#define __profcxx_hashtable_construct(__x...)  
+#endif
+
+// Turn on/off instrumentation for VECTOR_TOO_SMALL and VECTOR_TOO_LARGE.
+#if (defined(_GLIBCXX_PROFILE_VECTOR_TOO_SMALL) \
+     || defined(_GLIBCXX_PROFILE_VECTOR_TOO_LARGE))
+#define __profcxx_vector_resize(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_size_resize(__x))
+#define __profcxx_vector_destruct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_size_destruct(__x))
+#define __profcxx_vector_construct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_size_construct(__x))
+#else
+#define __profcxx_vector_resize(__x...)  
+#define __profcxx_vector_destruct(__x...) 
+#define __profcxx_vector_construct(__x...)  
+#endif 
+
+// Turn on/off instrumentation for INEFFICIENT_HASH.
+#if defined(_GLIBCXX_PROFILE_INEFFICIENT_HASH)
+#define __profcxx_hashtable_construct2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_hash_func_construct(__x))
+#define __profcxx_hashtable_destruct2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_hash_func_destruct(__x))
+#else
+#define __profcxx_hashtable_destruct2(__x...) 
+#define __profcxx_hashtable_construct2(__x...)  
+#endif
+
+// Turn on/off instrumentation for VECTOR_TO_LIST.
+#if defined(_GLIBCXX_PROFILE_VECTOR_TO_LIST)
+#define __profcxx_vector_construct2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_construct(__x))
+#define __profcxx_vector_destruct2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_destruct(__x))
+#define __profcxx_vector_insert(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_insert(__x))
+#define __profcxx_vector_iterate(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_iterate(__x))
+#define __profcxx_vector_invalid_operator(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_invalid_operator(__x))
+#define __profcxx_vector_resize2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_resize(__x))
+#define __profcxx_vector_find(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_vector_to_list_find(__x))
+#else
+#define __profcxx_vector_destruct2(__x...)
+#define __profcxx_vector_construct2(__x...)
+#define __profcxx_vector_insert(__x...)
+#define __profcxx_vector_iterate(__x...)
+#define __profcxx_vector_invalid_operator(__x...)
+#define __profcxx_vector_resize2(__x...)
+#define __profcxx_vector_find(__x...)
+#endif
+
+// Turn on/off instrumentation for LIST_TO_VECTOR. 
+#if defined(_GLIBCXX_PROFILE_LIST_TO_VECTOR)
+#define __profcxx_list_construct2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_vector_construct(__x))
+#define __profcxx_list_destruct2(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_vector_destruct(__x))
+#define __profcxx_list_insert(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_vector_insert(__x))
+#define __profcxx_list_iterate(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_vector_iterate(__x))
+#define __profcxx_list_invalid_operator(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_vector_invalid_operator(__x))
+#else
+#define __profcxx_list_destruct2(__x...)
+#define __profcxx_list_construct2(__x...)
+#define __profcxx_list_insert(__x...)
+#define __profcxx_list_iterate(__x...)
+#define __profcxx_list_invalid_operator(__x...)
+#endif
+
+// Turn on/off instrumentation for LIST_TO_SLIST.  
+#if defined(_GLIBCXX_PROFILE_LIST_TO_SLIST)
+#define __profcxx_list_rewind(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_slist_rewind(__x))
+#define __profcxx_list_operation(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_slist_operation(__x))
+#define __profcxx_list_destruct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_slist_destruct(__x))
+#define __profcxx_list_construct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_list_to_slist_construct(__x))
+#else
+#define __profcxx_list_rewind(__x...)  
+#define __profcxx_list_operation(__x...)
+#define __profcxx_list_destruct(__x...) 
+#define __profcxx_list_construct(__x...)  
+#endif 
+
+// Turn on/off instrumentation for MAP_TO_UNORDERED_MAP.
+#if defined(_GLIBCXX_PROFILE_MAP_TO_UNORDERED_MAP)
+#define __profcxx_map_to_unordered_map_construct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_construct(__x))
+#define __profcxx_map_to_unordered_map_destruct(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_destruct(__x))
+#define __profcxx_map_to_unordered_map_insert(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_insert(__x))
+#define __profcxx_map_to_unordered_map_erase(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_erase(__x))
+#define __profcxx_map_to_unordered_map_iterate(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_iterate(__x))
+#define __profcxx_map_to_unordered_map_invalidate(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_invalidate(__x))
+#define __profcxx_map_to_unordered_map_find(__x...) \
+  _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
+      __gnu_profile::__trace_map_to_unordered_map_find(__x))
+#else
+#define __profcxx_map_to_unordered_map_construct(__x...) \
+  
+#define __profcxx_map_to_unordered_map_destruct(__x...)
+#define __profcxx_map_to_unordered_map_insert(__x...)
+#define __profcxx_map_to_unordered_map_erase(__x...)
+#define __profcxx_map_to_unordered_map_iterate(__x...)
+#define __profcxx_map_to_unordered_map_invalidate(__x...)
+#define __profcxx_map_to_unordered_map_find(__x...)
+#endif
+
+// Set default values for compile-time customizable variables.
+#ifndef _GLIBCXX_PROFILE_TRACE_PATH_ROOT
+#define _GLIBCXX_PROFILE_TRACE_PATH_ROOT "libstdcxx-profile"
+#endif
+#ifndef _GLIBCXX_PROFILE_TRACE_ENV_VAR
+#define _GLIBCXX_PROFILE_TRACE_ENV_VAR "_GLIBCXX_PROFILE_TRACE_PATH_ROOT"
+#endif
+#ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR
+#define _GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR \
+  "_GLIBCXX_PROFILE_MAX_WARN_COUNT"
+#endif
+#ifndef _GLIBCXX_PROFILE_MAX_WARN_COUNT
+#define _GLIBCXX_PROFILE_MAX_WARN_COUNT 10
+#endif
+#ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH
+#define _GLIBCXX_PROFILE_MAX_STACK_DEPTH 32
+#endif
+#ifndef _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR
+#define _GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR \
+  "_GLIBCXX_PROFILE_MAX_STACK_DEPTH"
+#endif
+#ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC
+#define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC (1 << 28)
+#endif
+#ifndef _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR
+#define _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR \
+  "_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC"
+#endif
+
+// Instrumentation hook implementations.
+#include "profile/impl/profiler_hash_func.h"
+#include "profile/impl/profiler_hashtable_size.h"
+#include "profile/impl/profiler_map_to_unordered_map.h"
+#include "profile/impl/profiler_vector_size.h"
+#include "profile/impl/profiler_vector_to_list.h"
+#include "profile/impl/profiler_list_to_slist.h"
+#include "profile/impl/profiler_list_to_vector.h"
+
+#endif // _GLIBCXX_PROFILE_PROFILER_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_algos.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_algos.h
new file mode 100644
index 0000000..d4de43e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_algos.h
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_algos.h
+ *  @brief Algorithms used by the profile extension.
+ *
+ *  This file is needed to avoid including <algorithm> or <bits/stl_algo.h>.
+ *  Including those files would result in recursive includes.
+ *  These implementations are oversimplified.  In general, efficiency may be
+ *  sacrificed to minimize maintenance overhead.
+ */
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_ALGOS_H
+#define _GLIBCXX_PROFILE_PROFILER_ALGOS_H 1
+
+namespace __gnu_profile
+{
+  /* Helper for __top_n.  Insert in sorted vector, but not beyond Nth elem.  */
+  template<typename _Container>
+    void
+    __insert_top_n(_Container& __output,
+		   const typename _Container::value_type& __value,
+		   typename _Container::size_type __n)
+    {
+      typename _Container::iterator __it = __output.begin();
+      typename _Container::size_type __count = 0;
+
+      // Skip up to N - 1 elements larger than VALUE.
+      // XXX: Could do binary search for random iterators.
+      while (true)
+	{
+	  if (__count >= __n)
+	    // VALUE is not in top N.
+	    return;
+
+	  if (__it == __output.end())
+	    break;
+
+	  if (*__it < __value)
+	    break;
+
+	  ++__it;
+	  ++__count;
+	}
+
+      __output.insert(__it, __value);
+    }
+
+  /* Copy the top N elements in INPUT, sorted in reverse order, to OUTPUT.  */
+  template<typename _Container>
+    void
+    __top_n(const _Container& __input, _Container& __output,
+	    typename _Container::size_type __n)
+    {
+      __output.clear();
+      typename _Container::const_iterator __it;
+      for (__it = __input.begin(); __it != __input.end(); ++__it)
+	__insert_top_n(__output, *__it, __n);
+    }
+
+  /* Simplified clone of std::for_each.  */
+  template<typename _InputIterator, typename _Function>
+    _Function 
+    __for_each(_InputIterator __first, _InputIterator __last, _Function __f)
+    {
+      for (; __first != __last; ++__first)
+	__f(*__first);
+      return __f;
+    }
+
+  /* Simplified clone of std::remove.  */
+  template<typename _ForwardIterator, typename _Tp>
+    _ForwardIterator
+    __remove(_ForwardIterator __first, _ForwardIterator __last,
+	     const _Tp& __value)
+    {
+      if(__first == __last)
+	return __first;
+      _ForwardIterator __result = __first;
+      ++__first;
+      for(; __first != __last; ++__first)
+	if(!(*__first == __value))
+	  {
+	    *__result = *__first;
+	    ++__result;
+	  }
+      return __result;
+    }
+} // namespace __gnu_profile
+
+#endif /* _GLIBCXX_PROFILE_PROFILER_ALGOS_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_container_size.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_container_size.h
new file mode 100644
index 0000000..12cee54
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_container_size.h
@@ -0,0 +1,222 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_container_size.h
+ *  @brief Diagnostics for container sizes.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H
+#define _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H 1
+
+#include <sstream>
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+
+namespace __gnu_profile
+{
+  /** @brief A container size instrumentation line in the object table.  */
+  class __container_size_info
+  : public __object_info_base 
+  {
+  public:
+    __container_size_info()
+    : _M_init(0), _M_max(0), _M_min(0), _M_total(0), _M_item_min(0),
+      _M_item_max(0), _M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0) 
+    { }
+
+    __container_size_info(const __container_size_info& __o)
+    : __object_info_base(__o), _M_init(__o._M_init), _M_max(__o._M_max),
+      _M_min(__o._M_min), _M_total(__o._M_total),
+      _M_item_min(__o._M_item_min), _M_item_max(__o._M_item_max),
+      _M_item_total(__o._M_item_total), _M_count(__o._M_count),
+      _M_resize(__o._M_resize), _M_cost(__o._M_cost)
+    { }
+
+    __container_size_info(__stack_t __stack, std::size_t __num)
+    : __object_info_base(__stack), _M_init(__num), _M_max(__num),
+      _M_min(0), _M_total(0), _M_item_min(0), _M_item_max(0),
+      _M_item_total(0), _M_count(0), _M_resize(0), _M_cost(0)
+    { }
+
+    virtual ~__container_size_info() { }
+
+    void
+    __write(FILE* __f) const
+    {
+      std::fprintf(__f, "%Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu %Zu\n", 
+		   _M_init, _M_count, _M_cost, _M_resize, _M_min, _M_max,
+		   _M_total, _M_item_min, _M_item_max, _M_item_total);
+    }
+
+    float
+    __magnitude() const
+    { return static_cast<float>(_M_cost); }
+
+    std::string
+    __advice() const
+    {
+      std::stringstream __message;
+      if (_M_init < _M_item_max)
+	__message << "change initial container size from " << _M_init
+		  << " to " << _M_item_max;
+      return __message.str();
+    }
+
+    void
+    __merge(const __container_size_info& __o)
+    {
+      _M_init        = std::max(_M_init, __o._M_init);
+      _M_max         = std::max(_M_max, __o._M_max);
+      _M_item_max    = std::max(_M_item_max, __o._M_item_max);
+      _M_min         = std::min(_M_min, __o._M_min);
+      _M_item_min    = std::min(_M_item_min, __o._M_item_min);
+      _M_total      += __o._M_total;
+      _M_item_total += __o._M_item_total;
+      _M_count      += __o._M_count;
+      _M_cost       += __o._M_cost;
+      _M_resize     += __o._M_resize;
+    }
+
+    // Call if a container is destructed or cleaned.
+    void
+    __destruct(std::size_t __num, std::size_t __inum)
+    {
+      _M_max = std::max(_M_max, __num);
+      _M_item_max = std::max(_M_item_max, __inum);
+      if (_M_min == 0)
+	{
+	  _M_min = __num; 
+	  _M_item_min = __inum;
+	}
+      else
+	{
+	  _M_min = std::min(_M_min, __num);
+	  _M_item_min = std::min(_M_item_min, __inum);
+	}
+      _M_total += __num;
+      _M_item_total += __inum;
+      _M_count += 1;
+    }
+
+    // Estimate the cost of resize/rehash. 
+    float
+    __resize_cost(std::size_t __from, std::size_t)
+    { return __from; }
+
+    // Call if container is resized.
+    void
+    __resize(std::size_t __from, std::size_t __to)
+    {
+      _M_cost += this->__resize_cost(__from, __to);
+      _M_resize += 1;
+      _M_max = std::max(_M_max, __to);
+    }
+
+  private:
+    std::size_t _M_init;
+    std::size_t _M_max;  // range of # buckets
+    std::size_t _M_min;
+    std::size_t _M_total;
+    std::size_t _M_item_min;  // range of # items
+    std::size_t _M_item_max;
+    std::size_t _M_item_total;
+    std::size_t _M_count;
+    std::size_t _M_resize;
+    std::size_t _M_cost;
+  };
+
+
+  /** @brief A container size instrumentation line in the stack table.  */
+  class __container_size_stack_info
+  : public __container_size_info
+  {
+  public:
+    __container_size_stack_info(const __container_size_info& __o)
+    : __container_size_info(__o) { }
+  };
+
+  
+  /** @brief Container size instrumentation trace producer.  */
+  class __trace_container_size
+  : public __trace_base<__container_size_info, __container_size_stack_info> 
+  {
+  public:
+    ~__trace_container_size() { }
+
+    __trace_container_size()
+    : __trace_base<__container_size_info, __container_size_stack_info>() { };
+
+    // Insert a new node at construct with object, callstack and initial size. 
+    void
+    __insert(const __object_t __obj, __stack_t __stack, std::size_t __num)
+    { __add_object(__obj, __container_size_info(__stack, __num)); }
+
+    // XXX Undefined?
+    void
+    __construct(const void* __obj, std::size_t __inum);
+  
+    // Call at destruction/clean to set container final size.
+    void
+    __destruct(const void* __obj, std::size_t __num, std::size_t __inum)
+    {
+      if (!__is_on())
+	return;
+
+      __object_t __obj_handle = static_cast<__object_t>(__obj);
+
+      __container_size_info* __object_info = __get_object_info(__obj_handle);
+      if (!__object_info)
+	return;
+
+      __object_info->__destruct(__num, __inum);
+      __retire_object(__obj_handle);
+    }
+
+    // Call at resize to set resize/cost information.
+    void
+    __resize(const void* __obj, int __from, int __to)
+    {
+      if (!__is_on())
+	return;
+
+      __container_size_info* __object_info = __get_object_info(__obj);
+      if (!__object_info)
+	return;
+
+      __object_info->__resize(__from, __to);
+    }
+  };
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_CONTAINER_SIZE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hash_func.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hash_func.h
new file mode 100644
index 0000000..9f6c641
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hash_func.h
@@ -0,0 +1,181 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_hash_func.h
+ *  @brief Data structures to represent profiling traces.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H
+#define _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H 1
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+
+namespace __gnu_profile
+{
+  /** @brief A hash performance instrumentation line in the object table.  */
+  class __hashfunc_info
+  : public __object_info_base
+  {
+  public:
+    __hashfunc_info()
+    : _M_longest_chain(0), _M_accesses(0), _M_hops(0) { }
+
+    __hashfunc_info(const __hashfunc_info& __o)
+    : __object_info_base(__o), _M_longest_chain(__o._M_longest_chain),
+      _M_accesses(__o._M_accesses), _M_hops(__o._M_hops) { }
+
+    __hashfunc_info(__stack_t __stack)
+    : __object_info_base(__stack), _M_longest_chain(0),
+      _M_accesses(0), _M_hops(0) { }
+
+    virtual ~__hashfunc_info() { }
+
+    void
+    __merge(const __hashfunc_info& __o)
+    {
+      _M_longest_chain  = std::max(_M_longest_chain, __o._M_longest_chain);
+      _M_accesses      += __o._M_accesses;
+      _M_hops          += __o._M_hops;
+    }
+
+    void
+    __destruct(std::size_t __chain, std::size_t __accesses,
+	       std::size_t __hops)
+    { 
+      _M_longest_chain  = std::max(_M_longest_chain, __chain);
+      _M_accesses      += __accesses;
+      _M_hops          += __hops;
+    }
+
+    void
+    __write(FILE* __f) const
+    { std::fprintf(__f, "%Zu %Zu %Zu\n", _M_hops,
+		   _M_accesses, _M_longest_chain); }
+
+    float
+    __magnitude() const
+    { return static_cast<float>(_M_hops); }
+
+    std::string
+    __advice() const
+    { return "change hash function"; }
+
+  private:
+    std::size_t _M_longest_chain;
+    std::size_t _M_accesses;
+    std::size_t _M_hops;
+  };
+
+
+  /** @brief A hash performance instrumentation line in the stack table.  */
+  class __hashfunc_stack_info 
+  : public __hashfunc_info
+  {
+  public:
+    __hashfunc_stack_info(const __hashfunc_info& __o)
+    : __hashfunc_info(__o) { }
+  };
+
+
+  /** @brief Hash performance instrumentation producer.  */
+  class __trace_hash_func
+  : public __trace_base<__hashfunc_info, __hashfunc_stack_info> 
+  {
+  public:
+    __trace_hash_func()
+    : __trace_base<__hashfunc_info, __hashfunc_stack_info>()
+    { __id = "hash-distr"; }
+
+    ~__trace_hash_func() {}
+    
+    // Insert a new node at construct with object, callstack and initial size.
+    void
+    __insert(__object_t __obj, __stack_t __stack)
+    { __add_object(__obj, __hashfunc_info(__stack)); }
+
+    // Call at destruction/clean to set container final size.
+    void
+    __destruct(const void* __obj, std::size_t __chain,
+	       std::size_t __accesses, std::size_t __hops)
+    {
+      if (!__is_on())
+	return;
+
+      // First find the item from the live objects and update the informations.
+      __hashfunc_info* __objs = __get_object_info(__obj);
+      if (!__objs)
+	return;
+
+      __objs->__destruct(__chain, __accesses, __hops);
+      __retire_object(__obj);
+    }
+  };
+
+
+  inline void
+  __trace_hash_func_init()
+  { _GLIBCXX_PROFILE_DATA(_S_hash_func) = new __trace_hash_func(); }
+
+  inline void
+  __trace_hash_func_report(FILE* __f, __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_hash_func))
+      {
+	_GLIBCXX_PROFILE_DATA(_S_hash_func)->__collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_hash_func)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_hash_func_construct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_hash_func)->__insert(__obj, __get_stack());
+  }
+
+  inline void
+  __trace_hash_func_destruct(const void* __obj, std::size_t __chain,
+			     std::size_t __accesses, std::size_t __hops)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_hash_func)->__destruct(__obj, __chain,
+						    __accesses, __hops);
+  }
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_HASH_FUNC_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hashtable_size.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hashtable_size.h
new file mode 100644
index 0000000..9d5cbc7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hashtable_size.h
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_hashtable_size.h
+ *  @brief Collection of hashtable size traces.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H
+#define _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H 1
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+#include "profile/impl/profiler_state.h"
+#include "profile/impl/profiler_container_size.h"
+
+namespace __gnu_profile
+{
+  /** @brief Hashtable size instrumentation trace producer.  */
+  class __trace_hashtable_size
+  : public __trace_container_size
+  {
+  public:
+    __trace_hashtable_size()
+    : __trace_container_size()
+    { __id = "hashtable-size"; }
+  };
+
+  inline void
+  __trace_hashtable_size_init()
+  { _GLIBCXX_PROFILE_DATA(_S_hashtable_size) = new __trace_hashtable_size(); }
+
+  inline void
+  __trace_hashtable_size_report(FILE* __f, __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_hashtable_size))
+      {
+	_GLIBCXX_PROFILE_DATA(_S_hashtable_size)->
+	  __collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_hashtable_size_construct(const void* __obj, std::size_t __num)
+  {
+    if (!__profcxx_init())
+      return;
+  
+    _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__insert(__obj, __get_stack(),
+						       __num);
+  }
+
+  inline void
+  __trace_hashtable_size_destruct(const void* __obj, std::size_t __num, 
+				  std::size_t __inum)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__destruct(__obj, __num, __inum);
+  }
+
+  inline void
+  __trace_hashtable_size_resize(const void* __obj, std::size_t __from, 
+				std::size_t __to)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_hashtable_size)->__resize(__obj, __from, __to);
+  }
+
+} // namespace __gnu_profile
+
+#endif /* _GLIBCXX_PROFILE_PROFILER_HASHTABLE_SIZE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_slist.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_slist.h
new file mode 100644
index 0000000..299a17d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_slist.h
@@ -0,0 +1,215 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_list_to_slist.h
+ *  @brief Diagnostics for list to slist.
+ */
+
+// Written by Changhee Jung.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H
+#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H 1
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+
+namespace __gnu_profile
+{
+  class __list2slist_info
+  : public __object_info_base
+  {
+  public:
+    __list2slist_info()
+    : _M_rewind(false), _M_operations(0) { }
+  
+    __list2slist_info(__stack_t __stack)
+    : __object_info_base(__stack), _M_rewind(false), _M_operations(0) { }
+
+    virtual ~__list2slist_info() { }
+
+    __list2slist_info(const __list2slist_info& __o)
+    : __object_info_base(__o), _M_rewind(__o._M_rewind),
+      _M_operations(__o._M_operations) { }
+  
+    // XXX: the magnitude should be multiplied with a constant factor F,
+    // where F is 1 when the malloc size class of list nodes is different
+    // from the malloc size class of slist nodes.  When they fall into the same
+    // class, the only slist benefit is from having to set fewer links, so
+    // the factor F should be much smaller, closer to 0 than to 1.
+    // This could be implemented by passing the size classes in the config 
+    // file.  For now, we always assume F to be 1.
+
+    float
+    __magnitude() const
+    {
+      if (!_M_rewind)
+	return _M_operations;
+      else
+	return 0;
+    }
+    
+    void
+    __merge(const __list2slist_info&) { }
+
+    void
+    __write(FILE* __f) const
+    { std::fprintf(__f, "%s\n", _M_rewind ? "invalid" : "valid"); }
+
+    std::string
+    __advice() const
+    { return "change std::list to std::forward_list"; }
+
+    void
+    __opr_rewind()
+    {
+      _M_rewind = true;
+      _M_valid = false;
+    }
+
+    void
+    __record_operation()
+    { ++_M_operations; }
+
+    bool
+    __has_rewind()
+    { return _M_rewind; }
+
+  private:
+    bool _M_rewind;
+    std::size_t _M_operations;
+  };
+
+  class __list2slist_stack_info
+  : public __list2slist_info
+  {
+  public:
+    __list2slist_stack_info(const __list2slist_info& __o) 
+    : __list2slist_info(__o) { }
+  };
+
+  class __trace_list_to_slist
+  : public __trace_base<__list2slist_info, __list2slist_stack_info> 
+  {
+  public:
+    ~__trace_list_to_slist() { }
+
+    __trace_list_to_slist()
+    : __trace_base<__list2slist_info, __list2slist_stack_info>()
+    { __id = "list-to-slist"; }
+
+    void
+    __opr_rewind(const void* __obj)
+    {
+      __list2slist_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__opr_rewind();
+    }
+
+    void
+    __record_operation(const void* __obj)
+    {
+      __list2slist_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__record_operation();
+    }
+
+    void
+    __insert(const __object_t __obj, __stack_t __stack)
+    { __add_object(__obj, __list2slist_info(__stack)); }
+  
+    void
+    __destruct(const void* __obj)
+    {
+      if (!__is_on())
+	return;
+
+      __list2slist_info* __res = __get_object_info(__obj);
+      if (!__res)
+	return;
+
+      __retire_object(__obj);
+    }
+  };
+
+
+  inline void
+  __trace_list_to_slist_init()
+  { _GLIBCXX_PROFILE_DATA(_S_list_to_slist) = new __trace_list_to_slist(); }
+
+  inline void
+  __trace_list_to_slist_report(FILE* __f, __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_list_to_slist))
+      {
+	_GLIBCXX_PROFILE_DATA(_S_list_to_slist)->
+	  __collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_list_to_slist_rewind(const void* __obj) 
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__opr_rewind(__obj);
+  }
+
+  inline void
+  __trace_list_to_slist_operation(const void* __obj) 
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__record_operation(__obj);
+  }
+
+  inline void
+  __trace_list_to_slist_construct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__insert(__obj, __get_stack());
+  }
+
+  inline void
+  __trace_list_to_slist_destruct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_slist)->__destruct(__obj);
+  }
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_SLIST_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_vector.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_vector.h
new file mode 100644
index 0000000..df03267
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_vector.h
@@ -0,0 +1,331 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_list_to_vector.h
+ *  @brief diagnostics for list to vector.
+ */
+
+// Written by Changhee Jung.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H
+#define _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H 1
+
+#include <sstream>
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+
+namespace __gnu_profile
+{
+  /** @brief A list-to-vector instrumentation line in the object table.  */
+  class __list2vector_info
+  : public __object_info_base
+  {
+  public:
+    __list2vector_info()
+    : _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0),
+      _M_vector_cost(0), _M_valid(true), _M_max_size(0) { }
+
+    __list2vector_info(__stack_t __stack)
+    : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
+      _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true),
+      _M_max_size(0) { }
+
+    virtual ~__list2vector_info() { }
+
+    __list2vector_info(const __list2vector_info& __o)
+    : __object_info_base(__o), _M_shift_count(__o._M_shift_count),
+      _M_iterate(__o._M_iterate), _M_resize(__o._M_resize),
+      _M_list_cost(__o._M_list_cost), _M_vector_cost(__o._M_vector_cost),
+      _M_valid(__o._M_valid), _M_max_size(__o._M_max_size) { }
+
+    void
+    __merge(const __list2vector_info& __o)
+    {
+      _M_shift_count  += __o._M_shift_count;
+      _M_iterate      += __o._M_iterate;
+      _M_vector_cost  += __o._M_vector_cost;
+      _M_list_cost    += __o._M_list_cost;
+      _M_valid        &= __o._M_valid;
+      _M_resize       += __o._M_resize;
+      _M_max_size     = std::max( _M_max_size, __o._M_max_size);
+    }
+
+    void
+    __write(FILE* __f) const
+    {
+      std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
+		   _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
+    }
+
+    float
+    __magnitude() const
+    { return _M_list_cost - _M_vector_cost; }
+  
+    std::string
+    __advice() const
+    {
+      std::stringstream __sstream;
+      __sstream 
+	<< "change std::list to std::vector and its initial size from 0 to "
+	<< _M_max_size;
+      return __sstream.str();
+    }
+
+    std::size_t
+    __shift_count()
+    { return _M_shift_count; }
+  
+    std::size_t
+    __iterate()
+    { return _M_iterate; }
+  
+    float
+    __list_cost()
+    { return _M_list_cost; }
+  
+    std::size_t
+    __resize()
+    { return _M_resize; }
+  
+    void
+    __set_list_cost(float __lc)
+    { _M_list_cost = __lc; }
+    
+    void
+    __set_vector_cost(float __vc)
+    { _M_vector_cost = __vc; }
+    
+    bool
+    __is_valid()
+    { return _M_valid; }
+    
+    void
+    __set_invalid()
+    { _M_valid = false; }
+
+    void
+    __opr_insert(std::size_t __shift, std::size_t __size)
+    {
+      _M_shift_count += __shift;
+      _M_max_size = std::max(_M_max_size, __size);
+    }
+
+    void
+    __opr_iterate(std::size_t __num)
+    { _M_iterate += __num;}
+
+    void
+    __resize(std::size_t __from, std::size_t)
+    { _M_resize += __from; }
+
+  private:
+    std::size_t _M_shift_count;
+    std::size_t _M_iterate;
+    std::size_t _M_resize;
+    float _M_list_cost;
+    float _M_vector_cost;
+    bool  _M_valid;
+    std::size_t _M_max_size;
+  };
+
+  class __list2vector_stack_info 
+  : public __list2vector_info
+  {
+  public:
+    __list2vector_stack_info(const __list2vector_info& __o) 
+    : __list2vector_info(__o) {}
+  };
+
+  class __trace_list_to_vector
+  : public __trace_base<__list2vector_info, __list2vector_stack_info> 
+  {
+  public:
+    __trace_list_to_vector()
+    : __trace_base<__list2vector_info, __list2vector_stack_info>()
+    { __id = "list-to-vector"; }
+
+    ~__trace_list_to_vector() { }
+
+    // Insert a new node at construct with object, callstack and initial size.
+    void
+    __insert(__object_t __obj, __stack_t __stack)
+    { __add_object(__obj, __list2vector_info(__stack)); }
+
+    // Call at destruction/clean to set container final size.
+    void
+    __destruct(const void* __obj)
+    {
+      if (!__is_on())
+	return;
+
+      __list2vector_info* __res = __get_object_info(__obj);
+      if (!__res)
+	return;
+
+      float __vc = __vector_cost(__res->__shift_count(), __res->__iterate());
+      float __lc = __list_cost(__res->__shift_count(), __res->__iterate());
+      __res->__set_vector_cost(__vc);
+      __res->__set_list_cost(__lc);
+      __retire_object(__obj);
+    }
+
+    // Find the node in the live map.
+    __list2vector_info* __find(const void* __obj);
+
+    // Collect cost of operations.
+    void
+    __opr_insert(const void* __obj, std::size_t __shift, std::size_t __size)
+    {
+      __list2vector_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__opr_insert(__shift, __size);
+    }
+
+    void
+    __opr_iterate(const void* __obj, std::size_t __num)
+    {
+      __list2vector_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__opr_iterate(__num);
+    }
+
+    void
+    __invalid_operator(const void* __obj)
+    {
+      __list2vector_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__set_invalid();
+    }
+
+    void
+    __resize(const void* __obj, std::size_t __from, std::size_t __to)
+    {
+      __list2vector_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__resize(__from, __to);
+    }
+
+    float
+    __vector_cost(std::size_t __shift, std::size_t __iterate)
+    {
+      // The resulting vector will use a 'reserve' method.
+      return (__shift
+	      * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
+	      + __iterate
+	      * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value); 
+    }
+
+    float
+    __list_cost(std::size_t __shift, std::size_t __iterate)
+    {
+      return (__shift
+	      * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
+	      + __iterate
+	      * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value); 
+    }
+  };
+
+
+  inline void
+  __trace_list_to_vector_init()
+  { _GLIBCXX_PROFILE_DATA(_S_list_to_vector) = new __trace_list_to_vector(); }
+
+  inline void
+  __trace_list_to_vector_report(FILE* __f, __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_list_to_vector))
+      {
+	_GLIBCXX_PROFILE_DATA(_S_list_to_vector)->
+	  __collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_list_to_vector_construct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__insert(__obj, __get_stack());
+  }
+
+  inline void
+  __trace_list_to_vector_destruct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__destruct(__obj);
+  }
+
+  inline void
+  __trace_list_to_vector_insert(const void* __obj, 
+				std::size_t __shift, std::size_t __size)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_insert(__obj, __shift, 
+							   __size);
+  }
+
+  inline void
+  __trace_list_to_vector_iterate(const void* __obj, std::size_t __num = 1)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__opr_iterate(__obj, __num);
+  }
+
+  inline void
+  __trace_list_to_vector_invalid_operator(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__invalid_operator(__obj);
+  }
+
+  inline void
+  __trace_list_to_vector_resize(const void* __obj, 
+				std::size_t __from, std::size_t __to)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_list_to_vector)->__resize(__obj, __from, __to);
+  }
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_LIST_TO_VECTOR_H__ */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_map_to_unordered_map.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_map_to_unordered_map.h
new file mode 100644
index 0000000..cc7c849
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_map_to_unordered_map.h
@@ -0,0 +1,297 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_map_to_unordered_map.h
+ *  @brief Diagnostics for map to unordered_map.
+ */
+
+// Written by Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H
+#define _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H 1
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+
+namespace __gnu_profile
+{
+  inline int
+  __log2(std::size_t __size)
+  {
+    for (int __bit_count = sizeof(std::size_t) - 1; __bit_count >= 0;
+	 -- __bit_count) 
+      if ((2 << __bit_count) & __size)
+	return __bit_count;
+    return 0;
+  }
+
+  inline float
+  __map_insert_cost(std::size_t __size)
+  { return (_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor).__value 
+	    * static_cast<float>(__log2(__size))); }
+
+  inline float
+  __map_erase_cost(std::size_t __size)
+  { return (_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor).__value
+	    * static_cast<float>(__log2(__size))); }
+
+  inline float
+  __map_find_cost(std::size_t __size)
+  { return (_GLIBCXX_PROFILE_DATA(__map_find_cost_factor).__value
+	    * static_cast<float>(__log2(__size))); }
+
+  /** @brief A map-to-unordered_map instrumentation line in the 
+      object table.  */
+  class __map2umap_info
+  : public __object_info_base
+  {
+  public:
+    __map2umap_info()
+    : _M_insert(0), _M_erase(0), _M_find(0), _M_iterate(0),
+      _M_umap_cost(0.0), _M_map_cost(0.0), _M_valid(true) { }
+    
+    __map2umap_info(__stack_t __stack)
+    : __object_info_base(__stack), _M_insert(0), _M_erase(0), _M_find(0), 
+      _M_iterate(0), _M_umap_cost(0.0), _M_map_cost(0.0), _M_valid(true) { }
+
+    virtual ~__map2umap_info() { }
+
+    __map2umap_info(const __map2umap_info& __o)
+    : __object_info_base(__o), _M_insert(__o._M_insert),
+      _M_erase(__o._M_erase), _M_find(__o._M_find),
+      _M_iterate(__o._M_iterate), _M_umap_cost(__o._M_umap_cost),
+      _M_map_cost(__o._M_map_cost), _M_valid(__o._M_valid) { }
+
+    void
+    __merge(const __map2umap_info& __o)
+    {
+      _M_insert    += __o._M_insert;
+      _M_erase     += __o._M_erase;
+      _M_find      += __o._M_find;
+      _M_umap_cost += __o._M_umap_cost;
+      _M_map_cost  += __o._M_map_cost;
+      _M_valid     &= __o._M_valid;
+    }
+
+    void
+    __write(FILE* __f) const
+    {
+      std::fprintf(__f, "%Zu %Zu %Zu %Zu %.0f %.0f %s\n",
+		   _M_insert, _M_erase, _M_find, _M_iterate, _M_map_cost,
+		   _M_umap_cost, _M_valid ? "valid" : "invalid");
+    }
+
+    float
+    __magnitude() const
+    { return _M_map_cost - _M_umap_cost; }
+
+    std::string
+    __advice() const
+    { return "change std::map to std::unordered_map"; }
+
+    void
+    __record_insert(std::size_t __size, std::size_t __count)
+    {
+      _M_insert += __count;
+      _M_map_cost += __count * __map_insert_cost(__size);
+      _M_umap_cost
+	+= (__count
+	    * _GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor).__value);
+    }
+
+    void
+    __record_erase(std::size_t __size, std::size_t __count)
+    {
+      _M_erase += __count;
+      _M_map_cost += __count * __map_erase_cost(__size);
+      _M_umap_cost
+	+= (__count
+	    * _GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor).__value);
+    }
+
+    void
+    __record_find(std::size_t __size)
+    {
+      _M_find += 1;
+      _M_map_cost += __map_find_cost(__size);
+      _M_umap_cost += _GLIBCXX_PROFILE_DATA(__umap_find_cost_factor).__value;
+    }
+
+    void
+    __record_iterate(std::size_t __count)
+    {
+      _M_iterate += __count;
+      _M_map_cost
+	+= (__count
+	    * _GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor).__value);
+      _M_umap_cost
+	+= (__count
+	    * _GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor).__value);
+    }
+
+    void
+    __record_invalidate()
+    { _M_valid = false; }
+
+  private:
+    std::size_t _M_insert;
+    std::size_t _M_erase;
+    std::size_t _M_find;
+    std::size_t _M_iterate;
+    float _M_umap_cost;
+    float _M_map_cost;
+    bool  _M_valid;
+  };
+
+
+  /** @brief A map-to-unordered_map instrumentation line in the 
+      stack table.  */
+  class __map2umap_stack_info 
+  : public __map2umap_info
+  {
+  public:
+    __map2umap_stack_info(const __map2umap_info& __o)
+    : __map2umap_info(__o) { }
+  };
+
+  /** @brief Map-to-unordered_map instrumentation producer.  */
+  class __trace_map2umap
+  : public __trace_base<__map2umap_info, __map2umap_stack_info> 
+  {
+  public:
+    __trace_map2umap()
+    : __trace_base<__map2umap_info, __map2umap_stack_info>()
+    { __id = "map-to-unordered-map"; }
+  };
+
+  inline void
+  __trace_map_to_unordered_map_init()
+  { _GLIBCXX_PROFILE_DATA(_S_map2umap) = new __trace_map2umap(); }
+
+  inline void
+  __trace_map_to_unordered_map_report(FILE* __f,
+				      __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_map2umap)) 
+      {
+	_GLIBCXX_PROFILE_DATA(_S_map2umap)->__collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_map2umap)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_map_to_unordered_map_construct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_map2umap)->
+      __add_object(__obj, __map2umap_info(__get_stack()));
+  }
+
+  inline void
+  __trace_map_to_unordered_map_destruct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_map2umap)->__retire_object(__obj);
+  }
+
+  inline void
+  __trace_map_to_unordered_map_insert(const void* __obj, 
+				      std::size_t __size, std::size_t __count)
+  {
+    if (!__profcxx_init())
+      return;
+
+    __map2umap_info* __info
+      = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+
+    if (__info)
+      __info->__record_insert(__size, __count);
+  }
+
+  inline void
+  __trace_map_to_unordered_map_erase(const void* __obj, 
+				     std::size_t __size, std::size_t __count)
+  {
+    if (!__profcxx_init()) 
+      return;
+
+    __map2umap_info* __info 
+      = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+
+    if (__info)
+      __info->__record_erase(__size, __count);
+  }
+
+  inline void
+  __trace_map_to_unordered_map_find(const void* __obj, std::size_t __size)
+  {
+    if (!__profcxx_init())
+      return;
+
+    __map2umap_info* __info
+      = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+
+    if (__info)
+      __info->__record_find(__size);
+  }
+
+  inline void
+  __trace_map_to_unordered_map_iterate(const void* __obj, std::size_t __count)
+  {
+    if (!__profcxx_init())
+      return;
+
+    __map2umap_info* __info
+      = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+    
+    if (__info)
+      __info->__record_iterate(__count);
+  }
+
+  inline void
+  __trace_map_to_unordered_map_invalidate(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    __map2umap_info* __info
+      = _GLIBCXX_PROFILE_DATA(_S_map2umap)->__get_object_info(__obj);
+
+    if (__info)
+      __info->__record_invalidate();
+  }
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_MAP_TO_UNORDERED_MAP_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_node.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_node.h
new file mode 100644
index 0000000..c32b94e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_node.h
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_node.h
+ *  @brief Data structures to represent a single profiling event.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_NODE_H
+#define _GLIBCXX_PROFILE_PROFILER_NODE_H 1
+
+#include <cstdio> // FILE, fprintf
+
+#include <vector>
+#if defined _GLIBCXX_HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+namespace __gnu_profile
+{
+  typedef const void* __object_t;
+  typedef void* __instruction_address_t;
+  typedef std::_GLIBCXX_STD_C::vector<__instruction_address_t> __stack_npt;
+  typedef __stack_npt* __stack_t;
+
+  std::size_t __stack_max_depth();
+
+  inline __stack_t
+  __get_stack()
+  {
+#if defined _GLIBCXX_HAVE_EXECINFO_H
+    std::size_t __max_depth = __stack_max_depth();
+    if (__max_depth == 0)
+      return 0;
+    __stack_npt __buffer(__max_depth);
+    int __depth = backtrace(&__buffer[0], __max_depth);
+    __stack_t __stack = new __stack_npt(__depth);
+    __builtin_memcpy(&(*__stack)[0], &__buffer[0],
+		     __depth * sizeof(__object_t));
+    return __stack;
+#else
+    return 0;
+#endif
+  }
+
+  inline std::size_t
+  __size(__stack_t __stack)
+  {
+    if (!__stack)
+      return 0;
+    else
+      return __stack->size();
+  }
+
+  // XXX
+  inline void
+  __write(FILE* __f, __stack_t __stack)
+  {
+    if (!__stack)
+      return;
+  
+    __stack_npt::const_iterator __it;
+    for (__it = __stack->begin(); __it != __stack->end(); ++__it)
+      std::fprintf(__f, "%p ", *__it);
+  }
+
+  /** @brief Hash function for summary trace using call stack as index.  */
+  class __stack_hash 
+  {
+  public:
+    std::size_t
+    operator()(__stack_t __s) const
+    {
+      if (!__s) 
+	return 0;
+
+      __UINTPTR_TYPE__ __index = 0;
+      __stack_npt::const_iterator __it;
+      for (__it = __s->begin(); __it != __s->end(); ++__it)
+	__index += reinterpret_cast<__UINTPTR_TYPE__>(*__it);
+      return __index;
+    }
+
+    bool operator() (__stack_t __stack1, __stack_t __stack2) const
+    {
+      if (!__stack1 && !__stack2)
+	return true;
+      if (!__stack1 || !__stack2)
+	return false;
+      if (__stack1->size() != __stack2->size())
+	return false;
+
+      std::size_t __byte_size
+	= __stack1->size() * sizeof(__stack_npt::value_type);
+      return __builtin_memcmp(&(*__stack1)[0], &(*__stack2)[0],
+			      __byte_size) == 0;
+    }
+  };
+
+
+  /** @brief Base class for a line in the object table.  */
+  class __object_info_base
+  {
+  public:
+    __object_info_base() { }
+
+    __object_info_base(__stack_t __stack)
+    : _M_stack(__stack), _M_valid(true) { }
+
+    __object_info_base(const __object_info_base& __o)
+    : _M_stack(__o._M_stack), _M_valid(__o._M_valid) { }
+
+    virtual ~__object_info_base() { }
+
+    bool
+    __is_valid() const 
+    { return _M_valid; }
+    
+    __stack_t
+    __stack() const
+    { return _M_stack; }
+    
+    virtual void __write(FILE* __f) const = 0;
+
+  protected:
+    __stack_t _M_stack;
+    bool _M_valid;
+  };
+
+
+  /** @brief Base class for a line in the stack table.  */
+  template<typename __object_info>
+    class __stack_info_base
+    {
+    public:
+      __stack_info_base() { }
+      __stack_info_base(const __object_info& __info) = 0;
+      virtual ~__stack_info_base() {}
+      void __merge(const __object_info& __info) = 0;
+      virtual float __magnitude() const = 0;
+      virtual const char* __get_id() const = 0;
+    };
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_NODE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_state.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_state.h
new file mode 100644
index 0000000..111b97e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_state.h
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_state.h
+ *  @brief Global profiler state.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_STATE_H
+#define _GLIBCXX_PROFILE_PROFILER_STATE_H 1
+
+namespace __gnu_profile
+{
+  enum __state_type { __ON, __OFF, __INVALID };
+
+  _GLIBCXX_PROFILE_DEFINE_DATA(__state_type, __state, __INVALID);
+
+  inline bool
+  __turn(__state_type __s)
+  { return (_GLIBCXX_PROFILE_DATA(__state)
+	    == __sync_val_compare_and_swap(&_GLIBCXX_PROFILE_DATA(__state),
+					   __INVALID, __s)); }
+
+  inline bool
+  __turn_on()
+  { return __turn(__ON); }
+
+  inline bool
+  __turn_off()
+  { return __turn(__OFF); }
+
+  inline bool
+  __is_on()
+  { return _GLIBCXX_PROFILE_DATA(__state) == __ON; }
+
+  inline bool
+  __is_off()
+  { return _GLIBCXX_PROFILE_DATA(__state) == __OFF; }
+
+  inline bool
+  __is_invalid()
+  { return _GLIBCXX_PROFILE_DATA(__state) == __INVALID; }
+
+} // end namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_STATE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_trace.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_trace.h
new file mode 100644
index 0000000..1e00542
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_trace.h
@@ -0,0 +1,666 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_trace.h
+ *  @brief Data structures to represent profiling traces.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_TRACE_H
+#define _GLIBCXX_PROFILE_PROFILER_TRACE_H 1
+
+#include <cstdio>  // fopen, fclose, fprintf, FILE
+#include <cerrno>
+#include <cstdlib> // atof, atoi, strtol, getenv, atexit, abort
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#define _GLIBCXX_IMPL_UNORDERED_MAP std::_GLIBCXX_STD_C::unordered_map
+#include <unordered_map>
+#else
+#include <tr1/unordered_map>
+#define _GLIBCXX_IMPL_UNORDERED_MAP std::tr1::unordered_map
+#endif
+
+#include <ext/concurrence.h>
+#include <fstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "profile/impl/profiler_algos.h"
+#include "profile/impl/profiler_state.h"
+#include "profile/impl/profiler_node.h"
+
+namespace __gnu_profile
+{
+  /** @brief Internal environment.  Values can be set one of two ways:
+      1. In config file "var = value".  The default config file path is 
+         libstdcxx-profile.conf.
+      2. By setting process environment variables.  For instance, in a Bash
+         shell you can set the unit cost of iterating through a map like this:
+         export __map_iterate_cost_factor=5.0.
+	 If a value is set both in the input file and through an environment
+	 variable, the environment value takes precedence.  */
+  typedef _GLIBCXX_IMPL_UNORDERED_MAP<std::string, std::string> __env_t;
+
+  _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__env_t, __env);
+
+  /** @brief Master lock.  */
+  _GLIBCXX_PROFILE_DEFINE_UNINIT_DATA(__gnu_cxx::__mutex, __global_lock);
+
+  /** @brief Representation of a warning.  */
+  struct __warning_data
+  {
+    float __magnitude;
+    __stack_t __context;
+    const char* __warning_id;
+    std::string __warning_message;
+
+    __warning_data()
+    : __magnitude(0.0), __context(0), __warning_id(0) { }
+
+    __warning_data(float __m, __stack_t __c, const char* __id, 
+		   const std::string& __msg)
+    : __magnitude(__m), __context(__c), __warning_id(__id), 
+      __warning_message(__msg) { }
+
+    bool
+    operator<(const __warning_data& __other) const
+    { return __magnitude < __other.__magnitude; }
+  };
+
+  typedef std::_GLIBCXX_STD_C::vector<__warning_data> __warning_vector_t;
+
+  // Defined in profiler_<diagnostic name>.h.
+  class __trace_hash_func;
+  class __trace_hashtable_size;
+  class __trace_map2umap;
+  class __trace_vector_size;
+  class __trace_vector_to_list;
+  class __trace_list_to_slist; 
+  class __trace_list_to_vector; 
+  void __trace_vector_size_init();
+  void __trace_hashtable_size_init();
+  void __trace_hash_func_init();
+  void __trace_vector_to_list_init();
+  void __trace_list_to_slist_init();  
+  void __trace_list_to_vector_init();  
+  void __trace_map_to_unordered_map_init();
+  void __trace_vector_size_report(FILE*, __warning_vector_t&);
+  void __trace_hashtable_size_report(FILE*, __warning_vector_t&);
+  void __trace_hash_func_report(FILE*, __warning_vector_t&);
+  void __trace_vector_to_list_report(FILE*, __warning_vector_t&);
+  void __trace_list_to_slist_report(FILE*, __warning_vector_t&); 
+  void __trace_list_to_vector_report(FILE*, __warning_vector_t&);
+  void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&);
+
+  struct __cost_factor
+  {
+    const char* __env_var;
+    float __value;
+  };
+
+  typedef std::_GLIBCXX_STD_C::vector<__cost_factor*> __cost_factor_vector;
+
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_hash_func*, _S_hash_func, 0);
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_hashtable_size*, _S_hashtable_size, 0);
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_map2umap*, _S_map2umap, 0);
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_size*, _S_vector_size, 0);
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_vector_to_list*, _S_vector_to_list, 0);
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_slist*, _S_list_to_slist, 0); 
+  _GLIBCXX_PROFILE_DEFINE_DATA(__trace_list_to_vector*, _S_list_to_vector, 0);
+
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_shift_cost_factor, 
+			       {"__vector_shift_cost_factor", 1.0});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_iterate_cost_factor,
+			       {"__vector_iterate_cost_factor", 1.0});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __vector_resize_cost_factor,
+			       {"__vector_resize_cost_factor", 1.0}); 
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_shift_cost_factor,
+			       {"__list_shift_cost_factor", 0.0});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_iterate_cost_factor,
+			       {"__list_iterate_cost_factor", 10.0}); 
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __list_resize_cost_factor,
+			       {"__list_resize_cost_factor", 0.0}); 
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_insert_cost_factor,
+			       {"__map_insert_cost_factor", 1.5});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_erase_cost_factor,
+			       {"__map_erase_cost_factor", 1.5});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_find_cost_factor,
+			       {"__map_find_cost_factor", 1});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __map_iterate_cost_factor,
+			       {"__map_iterate_cost_factor", 2.3});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_insert_cost_factor,
+			       {"__umap_insert_cost_factor", 12.0});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_erase_cost_factor,
+			       {"__umap_erase_cost_factor", 12.0});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_find_cost_factor,
+			       {"__umap_find_cost_factor", 10.0});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor, __umap_iterate_cost_factor,
+			       {"__umap_iterate_cost_factor", 1.7});
+  _GLIBCXX_PROFILE_DEFINE_DATA(__cost_factor_vector*, __cost_factors, 0);
+
+  _GLIBCXX_PROFILE_DEFINE_DATA(const char*, _S_trace_file_name,
+			       _GLIBCXX_PROFILE_TRACE_PATH_ROOT);
+  _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_warn_count,
+			       _GLIBCXX_PROFILE_MAX_WARN_COUNT);
+  _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_stack_depth,
+			       _GLIBCXX_PROFILE_MAX_STACK_DEPTH);
+  _GLIBCXX_PROFILE_DEFINE_DATA(std::size_t, _S_max_mem,
+			       _GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC);
+
+  inline std::size_t
+  __stack_max_depth()
+  { return _GLIBCXX_PROFILE_DATA(_S_max_stack_depth); }
+
+  inline std::size_t
+  __max_mem()
+  { return _GLIBCXX_PROFILE_DATA(_S_max_mem); }
+
+  /** @brief Base class for all trace producers.  */
+  template<typename __object_info, typename __stack_info>
+    class __trace_base
+    {
+    public:
+      // Do not pick the initial size too large, as we don't know which
+      // diagnostics are more active.
+      __trace_base()
+      : __object_table(10000), __stack_table(10000),
+	__stack_table_byte_size(0), __id(0) { }
+
+      virtual ~__trace_base() { }
+
+      void __add_object(__object_t object, __object_info __info);
+      __object_info* __get_object_info(__object_t __object);
+      void __retire_object(__object_t __object);
+      void __write(FILE* __f);
+      void __collect_warnings(__warning_vector_t& __warnings);
+
+    private:
+      __gnu_cxx::__mutex __object_table_lock;
+      __gnu_cxx::__mutex __stack_table_lock;
+      typedef _GLIBCXX_IMPL_UNORDERED_MAP<__object_t, 
+					  __object_info> __object_table_t;
+      typedef _GLIBCXX_IMPL_UNORDERED_MAP<__stack_t, __stack_info,
+					  __stack_hash, 
+					  __stack_hash> __stack_table_t;
+      __object_table_t __object_table;
+      __stack_table_t __stack_table;
+      std::size_t __stack_table_byte_size;
+
+    protected:
+      const char* __id;
+    };
+
+  template<typename __object_info, typename __stack_info>
+    void
+    __trace_base<__object_info, __stack_info>::
+    __collect_warnings(__warning_vector_t& __warnings)
+    {
+      for (typename __stack_table_t::iterator __it
+	     = __stack_table.begin(); __it != __stack_table.end(); ++__it)
+	__warnings.push_back(__warning_data((*__it).second.__magnitude(),
+					    (*__it).first, __id,
+					    (*__it).second.__advice()));
+    }
+
+  template<typename __object_info, typename __stack_info>
+    void
+    __trace_base<__object_info, __stack_info>::
+    __add_object(__object_t __object, __object_info __info)
+    {
+      if (__max_mem() == 0 
+	  || __object_table.size() * sizeof(__object_info) <= __max_mem())
+	{
+	  this->__object_table_lock.lock();
+	  __object_table.insert(typename __object_table_t::
+				value_type(__object, __info));
+	  this->__object_table_lock.unlock();
+	}
+    }
+
+  template<typename __object_info, typename __stack_info>
+    __object_info*
+    __trace_base<__object_info, __stack_info>::
+    __get_object_info(__object_t __object)
+    {
+      // XXX: Revisit this to see if we can decrease mutex spans.
+      // Without this mutex, the object table could be rehashed during an
+      // insertion on another thread, which could result in a segfault.
+      this->__object_table_lock.lock();
+      typename __object_table_t::iterator __object_it
+	=  __object_table.find(__object);
+
+      if (__object_it == __object_table.end())
+	{
+	  this->__object_table_lock.unlock();
+	  return 0;
+	}
+      else
+	{
+	  this->__object_table_lock.unlock();
+	  return &__object_it->second;
+	}
+    }
+
+  template<typename __object_info, typename __stack_info>
+    void
+    __trace_base<__object_info, __stack_info>::
+    __retire_object(__object_t __object)
+    {
+      this->__object_table_lock.lock();
+      this->__stack_table_lock.lock();
+      typename __object_table_t::iterator __object_it
+	= __object_table.find(__object);
+  
+      if (__object_it != __object_table.end())
+	{
+	  const __object_info& __info = __object_it->second;
+	  const __stack_t& __stack = __info.__stack();
+	  typename __stack_table_t::iterator __stack_it
+	    = __stack_table.find(__stack);
+    
+	  if (__stack_it == __stack_table.end())
+	    {
+	      // First occurence of this call context.
+	      if (__max_mem() == 0 || __stack_table_byte_size < __max_mem()) 
+		{
+		  __stack_table_byte_size 
+		    += (sizeof(__instruction_address_t) * __size(__stack)
+			+ sizeof(__stack) + sizeof(__stack_info));
+		  __stack_table.insert(make_pair(__stack,
+						 __stack_info(__info)));
+		}
+	    }
+	  else
+	    {
+	      // Merge object info into info summary for this call context.
+	      __stack_it->second.__merge(__info);
+	      delete __stack;
+	    }
+	  __object_table.erase(__object);
+	}
+
+      this->__object_table_lock.unlock();
+      this->__stack_table_lock.unlock();
+    }
+
+  template<typename __object_info, typename __stack_info>
+    void
+    __trace_base<__object_info, __stack_info>::
+    __write(FILE* __f)
+    {
+      for (typename __stack_table_t::iterator __it
+	     = __stack_table.begin(); __it != __stack_table.end(); ++__it)
+	if (__it->second.__is_valid())
+	  {
+	    std::fprintf(__f, __id);
+	    std::fprintf(__f, "|");
+	    __gnu_profile::__write(__f, __it->first);
+	    std::fprintf(__f, "|");
+	    __it->second.__write(__f);
+	  }
+    }
+
+  inline std::size_t
+  __env_to_size_t(const char* __env_var, std::size_t __default_value)
+  {
+    char* __env_value = std::getenv(__env_var);
+    if (__env_value)
+      {
+	errno = 0;
+	long __converted_value = std::strtol(__env_value, 0, 10);
+	if (errno || __converted_value < 0)
+	  {
+	    std::fprintf(stderr,
+			 "Bad value for environment variable '%s'.\n",
+			 __env_var);
+	    std::abort();
+	  }
+	else
+	  return static_cast<std::size_t>(__converted_value);
+      }
+    else
+      return __default_value;
+  }
+
+  inline void
+  __set_max_stack_trace_depth()
+  {
+    _GLIBCXX_PROFILE_DATA(_S_max_stack_depth)
+      = __env_to_size_t(_GLIBCXX_PROFILE_MAX_STACK_DEPTH_ENV_VAR,
+			_GLIBCXX_PROFILE_DATA(_S_max_stack_depth));
+  }
+
+  inline void
+  __set_max_mem()
+  {
+    _GLIBCXX_PROFILE_DATA(_S_max_mem) 
+      = __env_to_size_t(_GLIBCXX_PROFILE_MEM_PER_DIAGNOSTIC_ENV_VAR,
+			_GLIBCXX_PROFILE_DATA(_S_max_mem));
+  }
+
+  inline int
+  __log_magnitude(float __f)
+  {
+    const float __log_base = 10.0;
+    int __result = 0;
+    int __sign = 1;
+
+    if (__f < 0) 
+      {
+	__f = -__f;
+	__sign = -1;
+      }
+
+    while (__f > __log_base) 
+      {
+	++__result;
+	__f /= 10.0;
+      }
+    return __sign * __result;
+  }
+
+  inline FILE* 
+  __open_output_file(const char* __extension)
+  {
+    // The path is made of _S_trace_file_name + "." + extension.
+    std::size_t __root_len 
+      = __builtin_strlen(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
+    std::size_t __ext_len = __builtin_strlen(__extension);
+    char* __file_name = new char[__root_len + 1 + __ext_len + 1];
+    __builtin_memcpy(__file_name,
+		     _GLIBCXX_PROFILE_DATA(_S_trace_file_name),
+		     __root_len);
+    *(__file_name + __root_len) = '.';
+    __builtin_memcpy(__file_name + __root_len + 1,
+		     __extension, __ext_len + 1);
+
+    FILE* __out_file = std::fopen(__file_name, "w");
+    if (!__out_file)
+      {
+	std::fprintf(stderr, "Could not open trace file '%s'.\n",
+		     __file_name);
+	std::abort();
+      }
+
+    delete[] __file_name;
+    return __out_file;
+  }
+
+  struct __warn
+  {
+    FILE* __file;
+
+    __warn(FILE* __f)
+    { __file = __f; }
+
+    void
+    operator()(const __warning_data& __info)
+    {
+      std::fprintf(__file,  __info.__warning_id);
+      std::fprintf(__file, ": improvement = %d",
+		   __log_magnitude(__info.__magnitude));
+      std::fprintf(__file, ": call stack = ");
+      __gnu_profile::__write(__file, __info.__context);
+      std::fprintf(__file, ": advice = %s\n",
+		   __info.__warning_message.c_str());
+    }
+  };
+
+  /** @brief Final report method, registered with @b atexit.
+   *
+   * This can also be called directly by user code, including signal handlers.
+   * It is protected against deadlocks by the reentrance guard in profiler.h.
+   * However, when called from a signal handler that triggers while within
+   * __gnu_profile (under the guarded zone), no output will be produced.
+   */
+  inline void
+  __report(void)
+  {
+    _GLIBCXX_PROFILE_DATA(__global_lock).lock();
+
+    __warning_vector_t __warnings, __top_warnings;
+
+    FILE* __raw_file = __open_output_file("raw");
+    __trace_vector_size_report(__raw_file, __warnings);
+    __trace_hashtable_size_report(__raw_file, __warnings);
+    __trace_hash_func_report(__raw_file, __warnings);
+    __trace_vector_to_list_report(__raw_file, __warnings);
+    __trace_list_to_slist_report(__raw_file, __warnings);
+    __trace_list_to_vector_report(__raw_file, __warnings);
+    __trace_map_to_unordered_map_report(__raw_file, __warnings);
+    std::fclose(__raw_file);
+
+    // Sort data by magnitude, keeping just top N.
+    std::size_t __cutoff = std::min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count),
+				    __warnings.size());
+    __top_n(__warnings, __top_warnings, __cutoff);
+
+    FILE* __warn_file = __open_output_file("txt");
+    __for_each(__top_warnings.begin(), __top_warnings.end(),
+	       __warn(__warn_file));
+    std::fclose(__warn_file);
+
+    _GLIBCXX_PROFILE_DATA(__global_lock).unlock();
+  }
+
+  inline void
+  __set_trace_path()
+  {
+    char* __env_trace_file_name = std::getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR);
+
+    if (__env_trace_file_name)
+      _GLIBCXX_PROFILE_DATA(_S_trace_file_name) = __env_trace_file_name;
+
+    // Make sure early that we can create the trace file.
+    std::fclose(__open_output_file("txt"));
+  }
+
+  inline void
+  __set_max_warn_count()
+  {
+    char* __env_max_warn_count_str
+      = std::getenv(_GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR);
+
+    if (__env_max_warn_count_str)
+      _GLIBCXX_PROFILE_DATA(_S_max_warn_count)
+	= static_cast<std::size_t>(std::atoi(__env_max_warn_count_str));
+  }
+
+  inline void
+  __read_cost_factors()
+  {
+    std::string __conf_file_name(_GLIBCXX_PROFILE_DATA(_S_trace_file_name));
+    __conf_file_name += ".conf";
+
+    std::ifstream __conf_file(__conf_file_name.c_str());
+
+    if (__conf_file.is_open())
+      {
+	std::string __line;
+
+	while (std::getline(__conf_file, __line))
+	  {
+	    std::string::size_type __i = __line.find_first_not_of(" \t\n\v");
+
+	    if (__line.length() <= 0 || __line[__i] == '#')
+	      // Skip empty lines or comments.
+	      continue;
+	  }
+
+	// Trim.
+	__line.erase(__remove(__line.begin(), __line.end(), ' '),
+		     __line.end());
+	std::string::size_type __pos = __line.find("=");
+	std::string __factor_name = __line.substr(0, __pos);
+	std::string::size_type __end = __line.find_first_of(";\n");
+	std::string __factor_value = __line.substr(__pos + 1, __end - __pos);
+
+	_GLIBCXX_PROFILE_DATA(__env)[__factor_name] = __factor_value;
+      }
+  }
+
+  struct __cost_factor_writer
+  {
+    FILE* __file;
+
+    __cost_factor_writer(FILE* __f)
+    : __file(__f) { }
+
+    void
+    operator() (const __cost_factor* __factor)
+    { std::fprintf(__file, "%s = %f\n", __factor->__env_var,
+		   __factor->__value); }
+  };
+
+  inline void
+  __write_cost_factors()
+  {
+    FILE* __file = __open_output_file("conf.out");
+    __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
+	       _GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
+	       __cost_factor_writer(__file));
+    std::fclose(__file);
+  }
+
+  struct __cost_factor_setter
+  {
+    void
+    operator()(__cost_factor* __factor)
+    {
+      // Look it up in the process environment first.
+      const char* __env_value = std::getenv(__factor->__env_var);
+
+      if (!__env_value)
+        {
+          // Look it up in the config file.
+          __env_t::iterator __it 
+	    = _GLIBCXX_PROFILE_DATA(__env).find(__factor->__env_var);
+          if (__it != _GLIBCXX_PROFILE_DATA(__env).end())
+            __env_value = (*__it).second.c_str();
+        }
+
+      if (__env_value)
+        __factor->__value = std::atof(__env_value);
+    }
+  };
+
+  inline void
+  __set_cost_factors()
+  {
+    _GLIBCXX_PROFILE_DATA(__cost_factors) = new __cost_factor_vector;
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__list_shift_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__list_resize_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__map_insert_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__map_erase_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__map_find_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__map_iterate_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__umap_insert_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__umap_erase_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__umap_find_cost_factor));
+    _GLIBCXX_PROFILE_DATA(__cost_factors)->
+      push_back(&_GLIBCXX_PROFILE_DATA(__umap_iterate_cost_factor));
+    __for_each(_GLIBCXX_PROFILE_DATA(__cost_factors)->begin(),
+	       _GLIBCXX_PROFILE_DATA(__cost_factors)->end(),
+	       __cost_factor_setter());
+  }
+
+  inline void
+  __profcxx_init_unconditional()
+  {
+    _GLIBCXX_PROFILE_DATA(__global_lock).lock();
+
+    if (__is_invalid())
+      {
+	__set_max_warn_count();
+
+	if (_GLIBCXX_PROFILE_DATA(_S_max_warn_count) == 0)
+	  __turn_off();
+	else
+	  {
+	    __set_max_stack_trace_depth();
+	    __set_max_mem();
+	    __set_trace_path();
+	    __read_cost_factors(); 
+	    __set_cost_factors();
+	    __write_cost_factors();
+
+	    __trace_vector_size_init();
+	    __trace_hashtable_size_init();
+	    __trace_hash_func_init();
+	    __trace_vector_to_list_init();
+	    __trace_list_to_slist_init(); 
+	    __trace_list_to_vector_init();
+	    __trace_map_to_unordered_map_init();
+
+	    std::atexit(__report);
+
+	    __turn_on();
+	  }
+      }
+
+    _GLIBCXX_PROFILE_DATA(__global_lock).unlock();
+  }
+
+  /** @brief This function must be called by each instrumentation point.
+   *
+   * The common path is inlined fully.
+   */
+  inline bool
+  __profcxx_init()
+  {
+    if (__is_invalid())
+      __profcxx_init_unconditional();
+
+    return __is_on();
+  }
+
+} // namespace __gnu_profile
+
+#endif /* _GLIBCXX_PROFILE_PROFILER_TRACE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_size.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_size.h
new file mode 100644
index 0000000..0af384f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_size.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_vector_size.h
+ *  @brief Collection of vector size traces.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H
+#define _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H 1
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+#include "profile/impl/profiler_state.h"
+#include "profile/impl/profiler_container_size.h"
+
+namespace __gnu_profile
+{
+  /** @brief Hashtable size instrumentation trace producer.  */
+  class __trace_vector_size
+  : public __trace_container_size
+  {
+  public:
+    __trace_vector_size()
+    : __trace_container_size()
+    { __id = "vector-size"; }
+  };
+
+  inline void
+  __trace_vector_size_init()
+  { _GLIBCXX_PROFILE_DATA(_S_vector_size) = new __trace_vector_size(); }
+
+  inline void
+  __trace_vector_size_report(FILE* __f, __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_vector_size))
+      {
+	_GLIBCXX_PROFILE_DATA(_S_vector_size)->__collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_vector_size)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_vector_size_construct(const void* __obj, std::size_t __num)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_size)->__insert(__obj, __get_stack(),
+						    __num);
+  }
+
+  inline void
+  __trace_vector_size_destruct(const void* __obj, std::size_t __num,
+			       std::size_t __inum)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_size)->__destruct(__obj, __num, __inum);
+  }
+
+  inline void
+  __trace_vector_size_resize(const void* __obj, std::size_t __from,
+			     std::size_t __to)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_size)->__resize(__obj, __from, __to);
+  }
+
+} // namespace __gnu_profile
+
+#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_SIZE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_to_list.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_to_list.h
new file mode 100644
index 0000000..9196313
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_to_list.h
@@ -0,0 +1,354 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT 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 COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/impl/profiler_vector_to_list.h
+ *  @brief diagnostics for vector to list.
+ */
+
+// Written by Lixia Liu and Silvius Rus.
+
+#ifndef _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H
+#define _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H 1
+
+#include "profile/impl/profiler.h"
+#include "profile/impl/profiler_node.h"
+#include "profile/impl/profiler_trace.h"
+
+namespace __gnu_profile
+{
+  /** @brief A vector-to-list instrumentation line in the object table.  */
+  class __vector2list_info
+  : public __object_info_base
+  {
+  public:
+    __vector2list_info()
+    : _M_shift_count(0), _M_iterate(0), _M_resize(0), _M_list_cost(0),
+      _M_vector_cost(0), _M_valid(true) { }
+
+    __vector2list_info(__stack_t __stack)
+    : __object_info_base(__stack), _M_shift_count(0), _M_iterate(0),
+      _M_resize(0), _M_list_cost(0), _M_vector_cost(0), _M_valid(true) { }
+
+    virtual ~__vector2list_info() { }
+
+    __vector2list_info(const __vector2list_info& __o)
+    : __object_info_base(__o), _M_shift_count(__o._M_shift_count),
+      _M_iterate(__o._M_iterate), _M_resize(__o._M_resize),
+      _M_list_cost(__o._M_list_cost), _M_vector_cost(__o._M_vector_cost),
+      _M_valid(__o._M_valid) { }
+
+    void
+    __merge(const __vector2list_info& __o)
+    {
+      _M_shift_count  += __o._M_shift_count;
+      _M_iterate      += __o._M_iterate;
+      _M_vector_cost  += __o._M_vector_cost;
+      _M_list_cost    += __o._M_list_cost;
+      _M_valid        &= __o._M_valid;
+      _M_resize       += __o._M_resize;
+    }
+
+    void
+    __write(FILE* __f) const
+    {
+      std::fprintf(__f, "%Zu %Zu %Zu %.0f %.0f\n", _M_shift_count,
+		   _M_resize, _M_iterate, _M_vector_cost, _M_list_cost);
+    }
+
+    float
+    __magnitude() const
+    { return _M_vector_cost - _M_list_cost; }
+
+    std::string
+    __advice() const 
+    { return "change std::vector to std::list"; }
+
+    std::size_t
+    __shift_count()
+    { return _M_shift_count; }
+
+    std::size_t
+    __iterate()
+    { return _M_iterate; }
+
+    float
+    __list_cost()
+    { return _M_list_cost; }
+
+    std::size_t
+    __resize()
+    { return _M_resize; }
+
+    void
+    __set_list_cost(float __lc)
+    { _M_list_cost = __lc; }
+    
+    void
+    __set_vector_cost(float __vc)
+    { _M_vector_cost = __vc; }
+    
+    bool
+    __is_valid()
+    { return _M_valid; }
+    
+    void
+    __set_invalid()
+    { _M_valid = false; }
+
+    void
+    __opr_insert(std::size_t __pos, std::size_t __num)
+    { _M_shift_count += __num - __pos; }
+
+    void
+    __opr_iterate(std::size_t __num)
+    { _M_iterate += __num; }
+
+    void
+    __resize(std::size_t __from, std::size_t)
+    { _M_resize += __from; }
+
+    void
+    __opr_find(std::size_t __size)
+    {
+      // Use average case complexity.
+      _M_iterate += 3.0 / 4.0 * __size;
+    }
+
+  private:
+    std::size_t _M_shift_count;
+    std::size_t _M_iterate;
+    std::size_t _M_resize;
+    float _M_list_cost;
+    float _M_vector_cost;
+    bool  _M_valid;
+  };
+
+
+  /** @brief A vector-to-list instrumentation line in the stack table.  */
+  class __vector2list_stack_info
+  : public __vector2list_info
+  {
+  public:
+    __vector2list_stack_info(const __vector2list_info& __o) 
+    : __vector2list_info(__o) { }
+  };
+
+
+  /** @brief Vector-to-list instrumentation producer.  */
+  class __trace_vector_to_list
+  : public __trace_base<__vector2list_info, __vector2list_stack_info> 
+  {
+  public:
+    __trace_vector_to_list()
+    : __trace_base<__vector2list_info, __vector2list_stack_info>()
+    { __id = "vector-to-list"; }
+
+    ~__trace_vector_to_list() { }
+
+    // Insert a new node at construct with object, callstack and initial size. 
+    void
+    __insert(__object_t __obj, __stack_t __stack)
+    { __add_object(__obj, __vector2list_info(__stack)); }
+
+    // Call at destruction/clean to set container final size.
+    void
+    __destruct(const void* __obj)
+    {
+      if (!__is_on())
+	return;
+
+      __vector2list_info* __res = __get_object_info(__obj);
+      if (!__res)
+	return;
+
+      float __vc = __vector_cost(__res->__shift_count(), __res->__iterate(),
+				 __res->__resize());
+      float __lc = __list_cost(__res->__shift_count(), __res->__iterate(),
+			       __res->__resize());
+      __res->__set_vector_cost(__vc);
+      __res->__set_list_cost(__lc);
+
+      __retire_object(__obj);
+    }
+
+    // Find the node in the live map.
+    // XXX Undefined?!?
+    __vector2list_info* __find(const void* __obj);
+
+    // Collect cost of operations.
+    void
+    __opr_insert(const void* __obj, std::size_t __pos, std::size_t __num)
+    {
+      __vector2list_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__opr_insert(__pos, __num);
+    }
+
+    void
+    __opr_iterate(const void* __obj, std::size_t __num)
+    {
+      __vector2list_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__opr_iterate(__num);
+    }
+
+    void
+    __invalid_operator(const void* __obj)
+    {
+      __vector2list_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__set_invalid();
+    }
+
+    void
+    __resize(const void* __obj, std::size_t __from, std::size_t __to)
+    {
+      __vector2list_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__resize(__from, __to);
+    }
+
+    float
+    __vector_cost(std::size_t __shift, std::size_t __iterate,
+		  std::size_t __resize)
+    {
+      return (__shift
+	      * _GLIBCXX_PROFILE_DATA(__vector_shift_cost_factor).__value
+	      + __iterate
+	      * _GLIBCXX_PROFILE_DATA(__vector_iterate_cost_factor).__value
+	      + __resize
+	      * _GLIBCXX_PROFILE_DATA(__vector_resize_cost_factor).__value);
+    }
+
+    float
+    __list_cost(std::size_t __shift, std::size_t __iterate,
+		std::size_t __resize)
+    {
+      return (__shift
+	      * _GLIBCXX_PROFILE_DATA(__list_shift_cost_factor).__value
+	      + __iterate
+	      * _GLIBCXX_PROFILE_DATA(__list_iterate_cost_factor).__value
+	      + __resize
+	      * _GLIBCXX_PROFILE_DATA(__list_resize_cost_factor).__value);
+    }
+
+    void
+    __opr_find(const void* __obj, std::size_t __size)
+    {
+      __vector2list_info* __res = __get_object_info(__obj);
+      if (__res)
+	__res->__opr_find(__size);
+    }
+  };
+
+
+  inline void
+  __trace_vector_to_list_init()
+  { _GLIBCXX_PROFILE_DATA(_S_vector_to_list) = new __trace_vector_to_list(); }
+
+  inline void
+  __trace_vector_to_list_report(FILE* __f, __warning_vector_t& __warnings)
+  {
+    if (_GLIBCXX_PROFILE_DATA(_S_vector_to_list))
+      {
+	_GLIBCXX_PROFILE_DATA(_S_vector_to_list)->
+	  __collect_warnings(__warnings);
+	_GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__write(__f);
+      }
+  }
+
+  inline void
+  __trace_vector_to_list_construct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__insert(__obj, __get_stack());
+  }
+
+  inline void
+  __trace_vector_to_list_destruct(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__destruct(__obj);
+  }
+
+  inline void
+  __trace_vector_to_list_insert(const void* __obj, std::size_t __pos,
+				std::size_t __num)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_insert(__obj, __pos,
+							   __num);
+  }
+
+  inline void
+  __trace_vector_to_list_iterate(const void* __obj, std::size_t __num = 1)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_iterate(__obj, __num);
+  }
+
+  inline void
+  __trace_vector_to_list_invalid_operator(const void* __obj)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__invalid_operator(__obj);
+  }
+
+  inline void
+  __trace_vector_to_list_resize(const void* __obj, std::size_t __from,
+				std::size_t __to)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__resize(__obj, __from, __to);
+  }
+
+  inline void
+  __trace_vector_to_list_find(const void* __obj, std::size_t __size)
+  {
+    if (!__profcxx_init())
+      return;
+
+    _GLIBCXX_PROFILE_DATA(_S_vector_to_list)->__opr_find(__obj, __size);
+  }
+
+} // namespace __gnu_profile
+#endif /* _GLIBCXX_PROFILE_PROFILER_VECTOR_TO_LIST_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/iterator_tracker.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/iterator_tracker.h
new file mode 100644
index 0000000..733429d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/iterator_tracker.h
@@ -0,0 +1,274 @@
+// Profiling iterator implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/iterator_tracker.h
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_ITERATOR_TRACKER
+#define _GLIBCXX_PROFILE_ITERATOR_TRACKER 1
+
+#include <ext/type_traits.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+
+  template<typename _Iterator, typename _Sequence>
+    class __iterator_tracker 
+    {
+      typedef __iterator_tracker _Self;
+
+      // The underlying iterator
+      _Iterator _M_current;
+
+      // The underlying data structure
+      const _Sequence* _M_ds;
+      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;
+
+      __iterator_tracker()
+      : _M_current(), _M_ds(0) { }
+
+      __iterator_tracker(const _Iterator& __i, const _Sequence* __seq) 
+      : _M_current(__i), _M_ds(__seq) { }
+
+      __iterator_tracker(const __iterator_tracker& __x) 
+      : _M_current(__x._M_current), _M_ds(__x._M_ds) { }
+
+      template<typename _MutableIterator>
+        __iterator_tracker(const __iterator_tracker<_MutableIterator,
+			   typename __gnu_cxx::__enable_if
+			   <(std::__are_same<_MutableIterator, typename
+			     _Sequence::iterator::_Base_iterator>::__value),
+			   _Sequence>::__type>& __x)
+	:  _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
+
+      _Iterator
+      base() const { return _M_current; }
+  
+      /**
+       * @brief Conversion to underlying non-debug iterator to allow
+       * better interaction with non-profile containers.
+       */
+      operator _Iterator() const { return _M_current; }
+
+      pointer
+      operator->() const { return &*_M_current; }
+
+      __iterator_tracker&
+      operator++()
+      {
+	_M_ds->_M_profile_iterate();
+	++_M_current;
+	return *this;
+      }
+
+      __iterator_tracker&
+      operator++(int)
+      {
+	_M_ds->_M_profile_iterate();
+	__iterator_tracker __tmp(*this);
+	++_M_current;
+	return __tmp;
+      }
+
+      __iterator_tracker&
+      operator--()
+      {
+	_M_ds->_M_profile_iterate(1);
+	--_M_current;
+	return *this;
+      }
+
+      __iterator_tracker&
+      operator--(int)
+      {
+	_M_ds->_M_profile_iterate(1);
+	__iterator_tracker __tmp(*this);
+	--_M_current;
+	return __tmp;
+      }
+
+      __iterator_tracker&
+      operator=(const __iterator_tracker& __x)
+      {
+	_M_current = __x._M_current;
+	return *this;
+      }
+
+      reference
+      operator*() const
+      { return *_M_current; }
+
+      // ------ Random access iterator requirements ------
+      reference
+      operator[](const difference_type& __n) const 
+      { return _M_current[__n]; }
+
+      __iterator_tracker&
+      operator+=(const difference_type& __n)
+      {
+	_M_current += __n;
+	return *this;
+      }
+
+      __iterator_tracker
+      operator+(const difference_type& __n) const
+      {
+	__iterator_tracker __tmp(*this);
+	__tmp += __n;
+	return __tmp;
+      }
+
+      __iterator_tracker&
+      operator-=(const difference_type& __n)
+      {
+	_M_current += -__n;
+	return *this;
+      }
+
+      __iterator_tracker
+      operator-(const difference_type& __n) const
+      {
+	__iterator_tracker __tmp(*this);
+	__tmp -= __n;
+	return __tmp;
+      }
+
+      void
+      _M_find()
+      { _M_ds->_M_profile_find(); }
+
+      const _Sequence*
+      _M_get_sequence() const
+      { return static_cast<const _Sequence*>(_M_ds); }
+  };
+
+  template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+    inline bool
+    operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	       const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() == __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline bool
+    operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+	       const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+    { return __lhs.base() == __rhs.base(); }
+
+  template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+    inline bool
+    operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	       const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() != __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline bool
+    operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+               const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+    { return __lhs.base() != __rhs.base(); }
+
+  template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+    inline bool
+    operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	      const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() < __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline bool
+    operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+	      const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+    { return __lhs.base() < __rhs.base(); }
+
+  template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+    inline bool
+    operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	       const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() <= __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline bool
+    operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+	       const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+    { return __lhs.base() <= __rhs.base(); }
+
+  template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+    inline bool
+    operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	      const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() > __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline bool
+    operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+	      const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+    { return __lhs.base() > __rhs.base(); }
+
+  template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+    inline bool
+    operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	       const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() >= __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline bool
+    operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+	       const __iterator_tracker<_Iterator, _Sequence>& __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 __iterator_tracker<_IteratorL, _Sequence>::difference_type
+    operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
+	      const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+    { return __lhs.base() - __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
+    operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
+	      const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+    { return __lhs.base() - __rhs.base(); }
+
+  template<typename _Iterator, typename _Sequence>
+    inline __iterator_tracker<_Iterator, _Sequence>
+    operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type
+	      __n,
+	      const __iterator_tracker<_Iterator, _Sequence>& __i)
+    { return __i + __n; }
+	
+}  // namespace __profile
+}  // namespace std
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/list b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/list
new file mode 100644
index 0000000..21279d2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/list
@@ -0,0 +1,640 @@
+// Profiling list implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/list
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_LIST
+#define _GLIBCXX_PROFILE_LIST 1
+
+#include <list>
+#include <profile/base.h> 
+#include <profile/iterator_tracker.h> 
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /** @brief List wrapper with performance instrumentation.  */
+template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+    class list
+    : public _GLIBCXX_STD_C::list<_Tp, _Allocator>
+    {
+      typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
+
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef __iterator_tracker<typename _Base::iterator, list>        
+				                    iterator;
+      typedef __iterator_tracker<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) 
+      { 
+        __profcxx_list_construct(this); 	// list2slist
+        __profcxx_list_construct2(this); 	// list2vector
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+      list(size_type __n)
+      : _Base(__n) 
+      { 
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+
+      list(size_type __n, const _Tp& __value,
+	   const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) 
+      { 
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+#else
+      explicit
+      list(size_type __n, const _Tp& __value = _Tp(),
+	   const _Allocator& __a = _Allocator())
+      : _Base(__n, __value, __a) 
+      { 
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+#endif
+
+      template<class _InputIterator>
+      list(_InputIterator __first, _InputIterator __last,
+	   const _Allocator& __a = _Allocator())
+      : _Base(__first, __last, __a)
+      {	 
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+
+      list(const list& __x)
+      : _Base(__x) 
+      { 
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+
+      list(const _Base& __x)
+      : _Base(__x) 
+      { 	
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      list(list&& __x)
+      : _Base(std::move(__x))
+      { 
+        __profcxx_list_construct(this); 
+        __profcxx_list_construct2(this); 
+      }
+
+      list(initializer_list<value_type> __l,
+           const allocator_type& __a = allocator_type())
+        : _Base(__l, __a) { }
+#endif
+
+      ~list() { 
+        __profcxx_list_destruct(this); 
+        __profcxx_list_destruct2(this); 
+      }
+
+      list&
+      operator=(const list& __x)
+      {
+	static_cast<_Base&>(*this) = __x;
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      list&
+      operator=(list&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      list&
+      operator=(initializer_list<value_type> __l)
+      {
+	static_cast<_Base&>(*this) = __l;
+	return *this;
+      }
+
+      void
+      assign(initializer_list<value_type> __l)
+      {	_Base::assign(__l); }
+#endif
+
+      template<class _InputIterator>
+        void
+        assign(_InputIterator __first, _InputIterator __last)
+        { _Base::assign(__first, __last); }
+
+      void
+      assign(size_type __n, const _Tp& __t)
+      {	_Base::assign(__n, __t); }
+
+      using _Base::get_allocator;
+
+      // iterators:
+      iterator
+      begin()
+      { return iterator(_Base::begin(), this); }
+
+      const_iterator
+      begin() const
+      { return const_iterator(_Base::begin(), this); }
+
+      iterator
+      end()
+      {
+        __profcxx_list_rewind(this);
+        return iterator(_Base::end(), this);
+      }
+
+      const_iterator
+      end() const
+      {
+        __profcxx_list_rewind(this);
+        return const_iterator(_Base::end(), this);
+      }
+
+      reverse_iterator
+      rbegin()
+      {
+        __profcxx_list_rewind(this);
+        return reverse_iterator(end());
+      }
+
+      const_reverse_iterator
+      rbegin() const
+      { 
+        __profcxx_list_rewind(this);
+        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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      resize(size_type __sz)
+      { _Base::resize(__sz); }
+
+      void
+      resize(size_type __sz, const _Tp& __c)
+      { _Base::resize(__sz, __c); }
+#else
+      void
+      resize(size_type __sz, _Tp __c = _Tp())
+      { _Base::resize(__sz, __c); }
+#endif
+
+      // element access:
+      reference
+      front()
+      { return _Base::front(); }
+
+      const_reference
+      front() const
+      { return _Base::front(); }
+
+      reference
+      back()
+      {
+        __profcxx_list_rewind(this);
+	return _Base::back();
+      }
+
+      const_reference
+      back() const
+      {
+        __profcxx_list_rewind(this);
+	return _Base::back();
+      }
+
+      // 23.2.2.3 modifiers:
+      void
+      push_front(const value_type& __x)
+      {
+        __profcxx_list_invalid_operator(this);
+        __profcxx_list_operation(this);
+        _Base::push_front(__x);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::emplace_front;
+#endif
+
+      void
+      pop_front()
+      {
+        __profcxx_list_operation(this);
+	_Base::pop_front();
+      }
+
+      using _Base::push_back;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::emplace_back;
+#endif
+
+      void
+      pop_back()
+      {
+	iterator __victim = end();
+	--__victim;
+	_Base::pop_back();
+        __profcxx_list_rewind(this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename... _Args>
+        iterator
+        emplace(iterator __position, _Args&&... __args)
+	{
+	  return iterator(_Base::emplace(__position.base(),
+                                         std::forward<_Args>(__args)...));
+	}
+#endif
+
+      iterator
+      insert(iterator __position, const _Tp& __x)
+      {
+        _M_profile_insert(this, __position, size());
+        return iterator(_Base::insert(__position.base(), __x), this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(iterator __position, _Tp&& __x)
+      { 
+        _M_profile_insert(this, __position, size());
+        return iterator(_Base::emplace(__position.base(), std::move(__x)),
+                        this); 
+      }
+
+      void
+      insert(iterator __position, initializer_list<value_type> __l)
+      {
+        _M_profile_insert(this, __position, size());
+        _Base::insert(__position.base(), __l);
+      }
+#endif
+
+      void
+      insert(iterator __position, size_type __n, const _Tp& __x)
+      {
+        _M_profile_insert(this, __position, size());
+	_Base::insert(__position.base(), __n, __x);
+      }
+
+      template<class _InputIterator>
+        void
+        insert(iterator __position, _InputIterator __first,
+	       _InputIterator __last)
+      {
+        _M_profile_insert(this, __position, size());
+        _Base::insert(__position.base(), __first, __last);
+      }
+
+      iterator
+      erase(iterator __position)
+      {	return iterator(_Base::erase(__position.base()), this); }
+
+      iterator
+      erase(iterator __position, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	return iterator(_Base::erase(__position.base(), __last.base()), this);
+      }
+
+      void
+      swap(list& __x)
+      {	_Base::swap(__x); }
+
+      void
+      clear()
+      {	_Base::clear(); }
+
+      // 23.2.2.4 list operations:
+      void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      splice(iterator __position, list&& __x)
+#else
+      splice(iterator __position, list& __x)
+#endif
+      { this->splice(__position, _GLIBCXX_MOVE(__x), __x.begin(), __x.end()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x)
+      { this->splice(__position, std::move(__x)); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __i)
+      { this->splice(__position, std::move(__x), __i); }
+#endif
+
+      void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      splice(iterator __position, list&& __x, iterator __i)
+#else
+      splice(iterator __position, list& __x, iterator __i)
+#endif
+      {
+	// We used to perform the splice_alloc check:  not anymore, redundant
+	// after implementing the relevant bits of N1599.
+
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	_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
+      {
+	// We used to perform the splice_alloc check:  not anymore, redundant
+	// after implementing the relevant bits of N1599.
+
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+		      __first.base(), __last.base());
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      splice(iterator __position, list& __x, iterator __first, iterator __last)
+      { this->splice(__position, std::move(__x), __first, __last); }
+#endif
+
+      void
+      remove(const _Tp& __value)
+      {
+	for (iterator __x = begin(); __x != end(); )
+	  {
+	    if (*__x == __value)
+	      __x = erase(__x);
+	    else
+	      ++__x;
+	  }
+      }
+
+      template<class _Predicate>
+        void
+        remove_if(_Predicate __pred)
+        {
+	  for (iterator __x = begin(); __x != end(); )
+	    {
+              __profcxx_list_operation(this);
+	      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)
+	  {
+            __profcxx_list_operation(this);
+	    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)
+	    {
+              __profcxx_list_operation(this);
+	      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)
+	  { _Base::merge(_GLIBCXX_MOVE(__x._M_base())); }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      merge(list& __x)
+      { this->merge(std::move(__x)); }
+#endif
+
+      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)
+	    { _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); }
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Compare>
+        void
+        merge(list& __x, _Compare __comp)
+        { this->merge(std::move(__x), __comp); }
+#endif
+
+      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; }
+
+      inline void _M_profile_find() const 
+      { }
+
+      inline void _M_profile_iterate(int __rewind = 0) const 
+      {
+        __profcxx_list_operation(this);
+        __profcxx_list_iterate(this); 
+        if (__rewind)
+          __profcxx_list_rewind(this);
+      }
+
+    private:
+      size_type _M_profile_insert(void* obj, iterator __pos, size_type __size)
+      {
+        size_type __shift = 0;
+        typename _Base::iterator __it = __pos.base();
+        for ( ; __it!=_Base::end(); __it++)
+          __shift++;
+        __profcxx_list_rewind(this);
+        __profcxx_list_operation(this);
+        __profcxx_list_insert(this, __shift, __size);
+      }
+    };
+
+  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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map
new file mode 100644
index 0000000..e396b85
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map
@@ -0,0 +1,41 @@
+// Profiling map/multimap implementation -*- C++ -*-
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/map
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MAP
+#define _GLIBCXX_PROFILE_MAP 1
+
+#include <map>
+#include <profile/map.h>
+#include <profile/multimap.h>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map.h
new file mode 100644
index 0000000..a58a2b0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map.h
@@ -0,0 +1,533 @@
+// Profiling map implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/map.h
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MAP_H
+#define _GLIBCXX_PROFILE_MAP_H 1
+
+#include <utility>
+#include <profile/base.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::map wrapper with performance instrumentation.
+  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+    class map
+    : public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>
+    {
+      typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _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 typename _Base::iterator       iterator;
+      typedef typename _Base::const_iterator       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.1.1 construct/copy/destroy:
+      explicit
+      map(const _Compare& __comp = _Compare(),
+	  const _Allocator& __a = _Allocator())
+      : _Base(__comp, __a)
+      { __profcxx_map_to_unordered_map_construct(this); }
+
+      template<typename _InputIterator>
+        map(_InputIterator __first, _InputIterator __last,
+	    const _Compare& __comp = _Compare(),
+	    const _Allocator& __a = _Allocator())
+	: _Base(__first, __last, __comp, __a)
+        { __profcxx_map_to_unordered_map_construct(this); }
+
+      map(const map& __x)
+      : _Base(__x)
+      { __profcxx_map_to_unordered_map_construct(this); }
+
+      map(const _Base& __x)
+      : _Base(__x)
+      { __profcxx_map_to_unordered_map_construct(this); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      map(map&& __x)
+      : _Base(std::move(__x))
+      { }
+
+      map(initializer_list<value_type> __l,
+	  const _Compare& __c = _Compare(),
+	  const allocator_type& __a = allocator_type())
+      : _Base(__l, __c, __a) { }
+#endif
+
+      ~map()
+      { __profcxx_map_to_unordered_map_destruct(this); }
+
+      map&
+      operator=(const map& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      map&
+      operator=(map&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->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 _Base::begin(); }
+
+      const_iterator
+      begin() const
+      { return _Base::begin(); }
+
+      iterator
+      end()
+      { return _Base::end(); }
+
+      const_iterator
+      end() const
+      { return _Base::end(); }
+
+      reverse_iterator
+      rbegin()
+      { 
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return reverse_iterator(end()); 
+      }
+
+      const_reverse_iterator
+      rbegin() const
+      {
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return const_reverse_iterator(end());
+      }
+
+      reverse_iterator
+      rend()
+      {
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return reverse_iterator(begin());
+      }
+
+      const_reverse_iterator
+      rend() const
+      {
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return const_reverse_iterator(begin());
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      const_iterator
+      cbegin() const
+      { return const_iterator(_Base::begin()); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_Base::end()); }
+
+      const_reverse_iterator
+      crbegin() const
+      {
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return const_reverse_iterator(end());
+      }
+
+      const_reverse_iterator
+      crend() const
+      {
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return const_reverse_iterator(begin());
+      }
+#endif
+
+      // capacity:
+      using _Base::empty;
+      using _Base::size;
+      using _Base::max_size;
+
+      // 23.3.1.2 element access:
+      mapped_type&
+      operator[](const key_type& __k)
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return _Base::operator[](__k);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      mapped_type&
+      operator[](key_type&& __k)
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return _Base::operator[](std::move(__k));
+      }
+#endif
+
+      mapped_type&
+      at(const key_type& __k)
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return _Base::at(__k);
+      }
+
+      const mapped_type&
+      at(const key_type& __k) const
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return _Base::at(__k);
+      }
+
+      // modifiers:
+      std::pair<iterator, bool>
+      insert(const value_type& __x)
+      {
+        __profcxx_map_to_unordered_map_insert(this, size(), 1);
+	typedef typename _Base::iterator _Base_iterator;
+	std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
+	return std::pair<iterator, bool>(iterator(__res.first),
+					 __res.second);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        std::pair<iterator, bool>
+        insert(_Pair&& __x)
+        {
+	  __profcxx_map_to_unordered_map_insert(this, size(), 1);
+	  typedef typename _Base::iterator _Base_iterator;
+	  std::pair<_Base_iterator, bool> __res
+	    = _Base::insert(std::forward<_Pair>(__x));
+	  return std::pair<iterator, bool>(iterator(__res.first),
+					   __res.second);
+	}
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(std::initializer_list<value_type> __list)
+      { 
+        size_type size_before = size();
+        _Base::insert(__list); 
+        __profcxx_map_to_unordered_map_insert(this, size_before, 
+					      size() - size_before);
+      }
+#endif
+
+      iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      insert(const_iterator __position, const value_type& __x)
+#else
+      insert(iterator __position, const value_type& __x)
+#endif
+      {
+        size_type size_before = size();
+	iterator __i = iterator(_Base::insert(__position, __x));
+        __profcxx_map_to_unordered_map_insert(this, size_before, 
+					      size() - size_before);
+	return __i;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __position, _Pair&& __x)
+        {
+	  size_type size_before = size();
+	  iterator __i
+	    = iterator(_Base::insert(__position, std::forward<_Pair>(__x)));
+	  __profcxx_map_to_unordered_map_insert(this, size_before, 
+						size() - size_before);
+	  return __i;
+      }
+#endif
+
+      template<typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        {
+          size_type size_before = size();
+	  _Base::insert(__first, __last);
+          __profcxx_map_to_unordered_map_insert(this, size_before, 
+                                                size() - size_before);
+	}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      {
+	iterator __i = _Base::erase(__position);
+        __profcxx_map_to_unordered_map_erase(this, size(), 1);
+        return __i;
+      }
+
+      iterator
+      erase(iterator __position)
+      { return erase(const_iterator(__position)); }
+#else
+      void
+      erase(iterator __position)
+      {
+	_Base::erase(__position);
+        __profcxx_map_to_unordered_map_erase(this, size(), 1);
+      }
+#endif
+
+      size_type
+      erase(const key_type& __x)
+      {
+	iterator __victim = find(__x);
+	if (__victim == end())
+	  return 0;
+	else
+	{
+	  _Base::erase(__victim);
+	  return 1;
+	}
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return iterator(_Base::erase(__first, __last)); }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      { _Base::erase(__first, __last); }
+#endif
+
+      void
+
+      swap(map& __x)
+      { _Base::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)
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return iterator(_Base::find(__x));
+      }
+
+      const_iterator
+      find(const key_type& __x) const
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return const_iterator(_Base::find(__x));
+      }
+
+      size_type
+      count(const key_type& __x) const
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+        return _Base::count(__x);
+      }
+
+      iterator
+      lower_bound(const key_type& __x)
+      { 
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return iterator(_Base::lower_bound(__x)); 
+      }
+
+      const_iterator
+      lower_bound(const key_type& __x) const
+      { 
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return const_iterator(_Base::lower_bound(__x)); 
+      }
+
+      iterator
+      upper_bound(const key_type& __x)
+      { 
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return iterator(_Base::upper_bound(__x)); 
+      }
+
+      const_iterator
+      upper_bound(const key_type& __x) const
+      { 
+        __profcxx_map_to_unordered_map_invalidate(this);
+        return const_iterator(_Base::upper_bound(__x)); 
+      }
+
+      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),
+			      iterator(__res.second));
+      }
+
+      std::pair<const_iterator,const_iterator>
+      equal_range(const key_type& __x) const
+      {
+        __profcxx_map_to_unordered_map_find(this, size());
+	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),
+			      const_iterator(__res.second));
+      }
+
+      _Base& 
+      _M_base() { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+    };
+
+  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)
+    { 
+      __profcxx_map_to_unordered_map_invalidate(&__lhs);
+      __profcxx_map_to_unordered_map_invalidate(&__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)
+    { 
+      __profcxx_map_to_unordered_map_invalidate(&__lhs);
+      __profcxx_map_to_unordered_map_invalidate(&__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)
+    {
+      __profcxx_map_to_unordered_map_invalidate(&__lhs);
+      __profcxx_map_to_unordered_map_invalidate(&__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)
+    {
+      __profcxx_map_to_unordered_map_invalidate(&__lhs);
+      __profcxx_map_to_unordered_map_invalidate(&__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)
+    {
+      __profcxx_map_to_unordered_map_invalidate(&__lhs);
+      __profcxx_map_to_unordered_map_invalidate(&__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)
+    {
+      __profcxx_map_to_unordered_map_invalidate(&__lhs);
+      __profcxx_map_to_unordered_map_invalidate(&__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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multimap.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multimap.h
new file mode 100644
index 0000000..3ee169b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multimap.h
@@ -0,0 +1,380 @@
+// Profiling multimap implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/multimap.h
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MULTIMAP_H
+#define _GLIBCXX_PROFILE_MULTIMAP_H 1
+
+#include <utility>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::multimap wrapper with performance instrumentation.
+  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+    class multimap
+    : public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
+    {
+      typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _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 typename _Base::iterator               iterator;
+      typedef typename _Base::const_iterator         const_iterator;
+      typedef typename _Base::reverse_iterator       reverse_iterator;
+      typedef typename _Base::const_reverse_iterator const_reverse_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;
+
+      // 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(__first, __last, __comp, __a) { }
+
+      multimap(const multimap& __x)
+      : _Base(__x) { }
+
+      multimap(const _Base& __x)
+      : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      multimap(multimap&& __x)
+      : _Base(std::move(__x))
+      { }
+
+      multimap(initializer_list<value_type> __l,
+	       const _Compare& __c = _Compare(),
+	       const allocator_type& __a = allocator_type())
+      : _Base(__l, __c, __a) { }
+#endif
+
+      ~multimap() { }
+
+      multimap&
+      operator=(const multimap& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      multimap&
+      operator=(multimap&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->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()); }
+
+      const_iterator
+      begin() const
+      { return const_iterator(_Base::begin()); }
+
+      iterator
+      end()
+      { return iterator(_Base::end()); }
+
+      const_iterator
+      end() const
+      { return const_iterator(_Base::end()); }
+
+      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()); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_Base::end()); }
+
+      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)); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(_Pair&& __x)
+        { return iterator(_Base::insert(std::forward<_Pair>(__x))); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(std::initializer_list<value_type> __list)
+      { _Base::insert(__list); }
+#endif
+
+      iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      insert(const_iterator __position, const value_type& __x)
+#else
+      insert(iterator __position, const value_type& __x)
+#endif
+      { return iterator(_Base::insert(__position, __x)); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __position, _Pair&& __x)
+        { return iterator(_Base::insert(__position,
+					std::forward<_Pair>(__x))); }
+#endif
+
+      template<typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        { _Base::insert(__first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      { return iterator(_Base::erase(__position)); }
+
+      iterator
+      erase(iterator __position)
+      { return iterator(_Base::erase(__position)); }
+#else
+      void
+      erase(iterator __position)
+      { _Base::erase(__position); }
+#endif
+
+      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++;
+	  _Base::erase(__victim);
+	  ++__count;
+	}
+	return __count;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return iterator(_Base::erase(__first, __last)); }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      { _Base::erase(__first, __last); }
+#endif
+
+      void
+      swap(multimap& __x)
+      { _Base::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)); }
+
+      const_iterator
+      find(const key_type& __x) const
+      { return const_iterator(_Base::find(__x)); }
+
+      using _Base::count;
+
+      iterator
+      lower_bound(const key_type& __x)
+      { return iterator(_Base::lower_bound(__x)); }
+
+      const_iterator
+      lower_bound(const key_type& __x) const
+      { return const_iterator(_Base::lower_bound(__x)); }
+
+      iterator
+      upper_bound(const key_type& __x)
+      { return iterator(_Base::upper_bound(__x)); }
+
+      const_iterator
+      upper_bound(const key_type& __x) const
+      { return const_iterator(_Base::upper_bound(__x)); }
+
+      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),
+			      iterator(__res.second));
+      }
+
+      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),
+			      const_iterator(__res.second));
+      }
+
+      _Base&
+      _M_base() { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+    };
+
+  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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multiset.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multiset.h
new file mode 100644
index 0000000..c6902a0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multiset.h
@@ -0,0 +1,367 @@
+// Profiling multiset implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/multiset.h
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MULTISET_H
+#define _GLIBCXX_PROFILE_MULTISET_H 1
+
+#include <utility>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::multiset wrapper with performance instrumentation.
+  template<typename _Key, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<_Key> >
+    class multiset
+    : public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>
+    {
+      typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _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 typename _Base::iterator               iterator;
+      typedef typename _Base::const_iterator         const_iterator;
+      typedef typename _Base::reverse_iterator       reverse_iterator;
+      typedef typename _Base::const_reverse_iterator const_reverse_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;
+
+      // 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(__first, __last, __comp, __a) { }
+
+      multiset(const multiset& __x)
+      : _Base(__x) { }
+
+      multiset(const _Base& __x)
+      : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      multiset(multiset&& __x)
+      : _Base(std::move(__x))
+      { }
+
+      multiset(initializer_list<value_type> __l,
+	       const _Compare& __comp = _Compare(),
+	       const allocator_type& __a = allocator_type())
+      : _Base(__l, __comp, __a) { }
+#endif
+
+      ~multiset() { }
+
+      multiset&
+      operator=(const multiset& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      multiset&
+      operator=(multiset&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->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()); }
+
+      const_iterator
+      begin() const
+      { return const_iterator(_Base::begin()); }
+
+      iterator
+      end()
+      { return iterator(_Base::end()); }
+
+      const_iterator
+      end() const
+      { return const_iterator(_Base::end()); }
+
+      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()); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_Base::end()); }
+
+      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)); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(value_type&& __x)
+      { return iterator(_Base::insert(std::move(__x))); }
+#endif
+
+      iterator
+      insert(const_iterator __position, const value_type& __x)
+      { return iterator(_Base::insert(__position, __x)); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(const_iterator __position, value_type&& __x)
+      { return iterator(_Base::insert(__position, std::move(__x))); }
+#endif
+
+      template<typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        { _Base::insert(__first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(initializer_list<value_type> __l)
+      { _Base::insert(__l); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      { return iterator(_Base::erase(__position)); }
+#else
+      void
+      erase(iterator __position)
+      { _Base::erase(__position); }
+#endif
+
+      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++;
+	  _Base::erase(__victim);
+	  ++__count;
+	}
+	return __count;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return iterator(_Base::erase(__first, __last)); }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      { _Base::erase(__first, __last); }
+#endif
+
+      void
+      swap(multiset& __x)
+      { _Base::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)); }
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 214. set::find() missing const overload
+      const_iterator
+      find(const key_type& __x) const
+      { return const_iterator(_Base::find(__x)); }
+
+      using _Base::count;
+
+      iterator
+      lower_bound(const key_type& __x)
+      { return iterator(_Base::lower_bound(__x)); }
+
+      // _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)); }
+
+      iterator
+      upper_bound(const key_type& __x)
+      { return iterator(_Base::upper_bound(__x)); }
+
+      // _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)); }
+
+      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),
+			      iterator(__res.second));
+      }
+
+      // _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),
+			      const_iterator(__res.second));
+      }
+
+      _Base&
+      _M_base() { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+    };
+
+  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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set
new file mode 100644
index 0000000..11603a8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set
@@ -0,0 +1,41 @@
+// Profiling set/multiset implementation -*- C++ -*-
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/set
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_SET
+#define _GLIBCXX_PROFILE_SET 1
+
+#include <set>
+#include <profile/set.h>
+#include <profile/multiset.h>
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set.h
new file mode 100644
index 0000000..d10a11f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set.h
@@ -0,0 +1,377 @@
+// Profiling set implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file profile/set.h
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_SET_H
+#define _GLIBCXX_PROFILE_SET_H 1
+
+#include <utility>
+
+namespace std _GLIBCXX_VISIBILITY(default) 
+{
+namespace __profile
+{
+  /// Class std::set wrapper with performance instrumentation.
+  template<typename _Key, typename _Compare = std::less<_Key>,
+	   typename _Allocator = std::allocator<_Key> >
+    class set
+    : public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator>
+    {
+      typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _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 typename _Base::iterator               iterator;
+      typedef typename _Base::const_iterator         const_iterator;
+      typedef typename _Base::reverse_iterator       reverse_iterator;
+      typedef typename _Base::const_reverse_iterator const_reverse_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;
+
+      // 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(__first, __last, __comp, __a) { }
+
+      set(const set& __x)
+      : _Base(__x) { }
+
+      set(const _Base& __x)
+      : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      set(set&& __x)
+      : _Base(std::move(__x))
+      { }
+
+      set(initializer_list<value_type> __l,
+	  const _Compare& __comp = _Compare(),
+	  const allocator_type& __a = allocator_type())
+      : _Base(__l, __comp, __a) { }
+#endif
+
+      ~set() { }
+
+      set&
+      operator=(const set& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      set&
+      operator=(set&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->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()); }
+
+      const_iterator
+      begin() const
+      { return const_iterator(_Base::begin()); }
+
+      iterator
+      end()
+      { return iterator(_Base::end()); }
+
+      const_iterator
+      end() const
+      { return const_iterator(_Base::end()); }
+
+      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()); }
+
+      const_iterator
+      cend() const
+      { return const_iterator(_Base::end()); }
+
+      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),
+					 __res.second);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      std::pair<iterator, bool>
+      insert(value_type&& __x)
+      {
+	typedef typename _Base::iterator _Base_iterator;
+	std::pair<_Base_iterator, bool> __res
+	  = _Base::insert(std::move(__x));
+	return std::pair<iterator, bool>(iterator(__res.first),
+					 __res.second);
+      }
+#endif
+
+      iterator
+      insert(const_iterator __position, const value_type& __x)
+      { return iterator(_Base::insert(__position, __x)); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(const_iterator __position, value_type&& __x)
+      { return iterator(_Base::insert(__position, std::move(__x))); }
+#endif
+
+      template <typename _InputIterator>
+        void
+        insert(_InputIterator __first, _InputIterator __last)
+        { _Base::insert(__first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      insert(initializer_list<value_type> __l)
+      { _Base::insert(__l); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __position)
+      { return iterator(_Base::erase(__position)); }
+#else
+      void
+      erase(iterator __position)
+      { _Base::erase(__position); }
+#endif
+
+      size_type
+      erase(const key_type& __x)
+      {
+	iterator __victim = find(__x);
+	if (__victim == end())
+          return 0;
+	else
+        {
+	  _Base::erase(__victim);
+	  return 1;
+        }
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      erase(const_iterator __first, const_iterator __last)
+      { return iterator(_Base::erase(__first, __last)); }
+#else
+      void
+      erase(iterator __first, iterator __last)
+      { _Base::erase(__first, __last); }
+#endif
+
+      void
+      swap(set& __x)
+      { _Base::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)); }
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 214. set::find() missing const overload
+      const_iterator
+      find(const key_type& __x) const
+      { return const_iterator(_Base::find(__x)); }
+
+      using _Base::count;
+
+      iterator
+      lower_bound(const key_type& __x)
+      { return iterator(_Base::lower_bound(__x)); }
+
+      // _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)); }
+
+      iterator
+      upper_bound(const key_type& __x)
+      { return iterator(_Base::upper_bound(__x)); }
+
+      // _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)); }
+
+      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),
+			      iterator(__res.second));
+      }
+
+      // _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),
+			      const_iterator(__res.second));
+      }
+
+      _Base&
+      _M_base() { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+    };
+
+  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); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_map
new file mode 100644
index 0000000..cc54009
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_map
@@ -0,0 +1,576 @@
+// Profiling unordered_map/unordered_multimap implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/unordered_map
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_UNORDERED_MAP
+#define _GLIBCXX_PROFILE_UNORDERED_MAP 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+# include <unordered_map>
+
+#include <profile/base.h>
+
+#define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /// Class std::unordered_map wrapper with performance instrumentation.
+  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_BASE
+    {
+      typedef typename _GLIBCXX_STD_BASE _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 typename _Base::difference_type difference_type;
+      typedef typename _Base::reference       reference;
+      typedef typename _Base::const_reference const_reference;
+      typedef typename _Base::mapped_type      mapped_type;
+
+      typedef typename _Base::iterator iterator;
+      typedef typename _Base::const_iterator 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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      template<typename _InputIterator>
+        unordered_map(_InputIterator __f, _InputIterator __l,
+		      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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      unordered_map(const _Base& __x)
+      : _Base(__x) 
+      { 
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      unordered_map(unordered_map&& __x)
+      : _Base(std::move(__x)) 
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      unordered_map(initializer_list<value_type> __l,
+		    size_type __n = 0,
+		    const hasher& __hf = hasher(),
+		    const key_equal& __eql = key_equal(),
+		    const allocator_type& __a = allocator_type())
+      : _Base(__l, __n, __hf, __eql, __a) { }
+
+      unordered_map&
+      operator=(const unordered_map& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+      unordered_map&
+      operator=(unordered_map&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      unordered_map&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l);
+	return *this;
+      }
+
+      ~unordered_map()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(),
+				     _Base::size());
+        _M_profile_destruct();
+      }
+
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+
+      void
+      clear()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(),
+				     _Base::size());
+        _M_profile_destruct();
+        _Base::clear();
+      }
+
+      void
+      insert(std::initializer_list<value_type> __l)
+      { 
+        size_type __old_size = _Base::bucket_count(); 
+        _Base::insert(__l);
+        _M_profile_resize(__old_size); 
+      }
+
+      std::pair<iterator, bool>
+      insert(const value_type& __obj)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        std::pair<iterator, bool> __res = _Base::insert(__obj);
+        _M_profile_resize(__old_size); 
+        return __res;
+      }
+
+      iterator
+      insert(const_iterator __iter, const value_type& __v)
+      { 
+        size_type __old_size = _Base::bucket_count(); 
+        iterator __res = _Base::insert(__iter, __v);
+        _M_profile_resize(__old_size); 
+        return __res;
+      }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        std::pair<iterator, bool>
+        insert(_Pair&& __obj)
+        {
+	  size_type __old_size =  _Base::bucket_count();
+	  std::pair<iterator, bool> __res
+	    = _Base::insert(std::forward<_Pair>(__obj));
+	  _M_profile_resize(__old_size); 
+	  return __res;
+	}
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __iter, _Pair&& __v)
+        { 
+	  size_type __old_size = _Base::bucket_count(); 
+	  iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
+	  _M_profile_resize(__old_size); 
+	  return __res;
+	}
+
+      template<typename _InputIter>
+        void
+        insert(_InputIter __first, _InputIter __last)
+        {
+	  size_type __old_size = _Base::bucket_count(); 
+	  _Base::insert(__first, __last);
+	  _M_profile_resize(__old_size); 
+	}
+
+      void
+      insert(const value_type* __first, const value_type* __last)
+      {
+        size_type __old_size = _Base::bucket_count(); 
+        _Base::insert(__first, __last);
+        _M_profile_resize(__old_size); 
+      }
+
+      // operator[]
+      mapped_type&
+      operator[](const _Key& __k)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        mapped_type& __res = _M_base()[__k];
+        _M_profile_resize(__old_size); 
+        return __res;
+      }
+
+      mapped_type&
+      operator[](_Key&& __k)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        mapped_type& __res = _M_base()[std::move(__k)];
+        _M_profile_resize(__old_size); 
+        return __res;
+      }
+
+      void
+      swap(unordered_map& __x)
+      { _Base::swap(__x); }
+
+      void rehash(size_type __n)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        _Base::rehash(__n);
+        _M_profile_resize(__old_size); 
+      }
+
+    private:
+      void
+      _M_profile_resize(size_type __old_size)
+      {
+	size_type __new_size = _Base::bucket_count();
+        if (__old_size != __new_size)
+	  __profcxx_hashtable_resize(this, __old_size, __new_size);
+      }
+
+      void
+      _M_profile_destruct()
+      {
+        size_type __hops = 0, __lc = 0, __chain = 0;
+        for (iterator __it = _M_base().begin(); __it != _M_base().end();
+	     ++__it)
+	  {
+	    while (__it._M_cur_node->_M_next)
+	      {
+		++__chain;
+		++__it;
+	      }
+	    if (__chain)
+	      {
+		++__chain;
+		__lc = __lc > __chain ? __lc : __chain;  
+		__hops += __chain * (__chain - 1) / 2;
+		__chain = 0;
+	      }
+	  }
+        __profcxx_hashtable_destruct2(this, __lc,  _Base::size(), __hops); 
+      }
+   };
+
+  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 bool
+    operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Key, typename _Tp, typename _Hash,
+	   typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+#define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
+
+  /// Class std::unordered_multimap wrapper with performance instrumentation.
+  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_BASE
+    {      
+      typedef typename _GLIBCXX_STD_BASE _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 typename _Base::difference_type difference_type;
+      typedef typename _Base::reference       reference;
+      typedef typename _Base::const_reference const_reference;
+
+      typedef typename _Base::iterator iterator;
+      typedef typename _Base::const_iterator 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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+      template<typename _InputIterator>
+        unordered_multimap(_InputIterator __f, _InputIterator __l,
+			   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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      unordered_multimap(const _Base& __x)
+      : _Base(__x)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      unordered_multimap(unordered_multimap&& __x)
+      : _Base(std::move(__x))
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      unordered_multimap(initializer_list<value_type> __l,
+			 size_type __n = 0,
+			 const hasher& __hf = hasher(),
+			 const key_equal& __eql = key_equal(),
+			 const allocator_type& __a = allocator_type())
+      : _Base(__l, __n, __hf, __eql, __a) { }
+
+      unordered_multimap&
+      operator=(const unordered_multimap& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+      unordered_multimap&
+      operator=(unordered_multimap&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      unordered_multimap&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l);
+	return *this;
+      }
+
+      ~unordered_multimap()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(), 
+				     _Base::size());
+        _M_profile_destruct();
+      }
+
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+
+      void
+      clear()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(), 
+				     _Base::size());
+        _M_profile_destruct();
+        _Base::clear();
+      }
+
+      void
+      insert(std::initializer_list<value_type> __l)
+      { 
+        size_type __old_size =  _Base::bucket_count();
+        _Base::insert(__l);
+        _M_profile_resize(__old_size, _Base::bucket_count());
+      }
+
+      iterator
+      insert(const value_type& __obj)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        iterator __res = _Base::insert(__obj);
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
+      iterator
+      insert(const_iterator __iter, const value_type& __v)
+      { 
+        size_type __old_size = _Base::bucket_count(); 
+        iterator __res = _Base::insert(__iter, __v);
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(_Pair&& __obj)
+        {
+	  size_type __old_size =  _Base::bucket_count();
+	  iterator __res = _Base::insert(std::forward<_Pair>(__obj));
+	  _M_profile_resize(__old_size, _Base::bucket_count()); 
+	  return __res;
+	}
+
+      template<typename _Pair, typename = typename
+	       std::enable_if<std::is_convertible<_Pair,
+						  value_type>::value>::type>
+        iterator
+        insert(const_iterator __iter, _Pair&& __v)
+        {
+	  size_type __old_size = _Base::bucket_count(); 
+	  iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
+	  _M_profile_resize(__old_size, _Base::bucket_count()); 
+	  return __res;
+	}
+
+      template<typename _InputIter>
+        void
+        insert(_InputIter __first, _InputIter __last)
+        {
+	  size_type __old_size = _Base::bucket_count(); 
+	  _Base::insert(__first, __last);
+	  _M_profile_resize(__old_size, _Base::bucket_count()); 
+	}
+
+      void
+      insert(const value_type* __first, const value_type* __last)
+      {
+        size_type __old_size = _Base::bucket_count(); 
+        _Base::insert(__first, __last);
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+      }
+
+      void
+      swap(unordered_multimap& __x)
+      { _Base::swap(__x); }
+
+      void rehash(size_type __n)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        _Base::rehash(__n);
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+      }
+
+    private:
+      void
+      _M_profile_resize(size_type __old_size, size_type __new_size)
+      {
+        if (__old_size != __new_size)
+          __profcxx_hashtable_resize(this, __old_size, __new_size);
+      }
+
+      void
+      _M_profile_destruct()
+      {
+        size_type __hops = 0, __lc = 0, __chain = 0;
+        for (iterator __it = _M_base().begin(); __it != _M_base().end();
+	     ++__it)
+	  {
+	    while (__it._M_cur_node->_M_next)
+	      {
+		++__chain;
+		++__it;
+	      }
+	    if (__chain)
+	      {
+		++__chain;
+		__lc = __lc > __chain ? __lc : __chain;
+		__hops += __chain * (__chain - 1) / 2;
+		__chain = 0;
+	      }
+	  }
+        __profcxx_hashtable_destruct2(this, __lc,  _Base::size(), __hops);
+      }
+
+    };
+
+  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 bool
+    operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Key, typename _Tp, typename _Hash,
+	   typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+} // namespace __profile
+} // namespace std
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_set
new file mode 100644
index 0000000..547fb76
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_set
@@ -0,0 +1,542 @@
+// Profiling unordered_set/unordered_multiset implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/unordered_set
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_UNORDERED_SET
+#define _GLIBCXX_PROFILE_UNORDERED_SET 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+# include <unordered_set>
+
+#include <profile/base.h>
+
+#define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc>
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  /** @brief Unordered_set wrapper with performance instrumentation.  */
+  template<typename _Key, 
+	   typename _Hash  = std::hash<_Key>,
+	   typename _Pred = std::equal_to<_Key>,
+	   typename _Alloc =  std::allocator<_Key> >
+    class unordered_set
+    : public _GLIBCXX_STD_BASE
+    {
+      typedef typename _GLIBCXX_STD_BASE _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 typename _Base::difference_type difference_type;
+      typedef typename _Base::reference       reference;
+      typedef typename _Base::const_reference const_reference;
+
+      typedef typename _Base::iterator iterator;
+      typedef typename _Base::const_iterator 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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      template<typename _InputIterator>
+        unordered_set(_InputIterator __f, _InputIterator __l,
+		      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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      unordered_set(const _Base& __x)
+      : _Base(__x) 
+      { 
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      unordered_set(unordered_set&& __x)
+      : _Base(std::move(__x)) 
+      { 
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+        __profcxx_hashtable_construct2(this);
+      }
+
+      unordered_set(initializer_list<value_type> __l,
+		    size_type __n = 0,
+		    const hasher& __hf = hasher(),
+		    const key_equal& __eql = key_equal(),
+		    const allocator_type& __a = allocator_type())
+      : _Base(__l, __n, __hf, __eql, __a) { }
+
+      unordered_set&
+      operator=(const unordered_set& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+      unordered_set&
+      operator=(unordered_set&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      unordered_set&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l);
+	return *this;
+      }
+
+      ~unordered_set()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(), 
+                                     _Base::size());
+        _M_profile_destruct();
+      }
+
+      void
+      swap(unordered_set& __x)
+      {
+        _Base::swap(__x);
+      }
+
+      void
+      clear()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(), 
+                                     _Base::size());
+        _M_profile_destruct();
+        _Base::clear();
+      }
+
+      void
+      insert(std::initializer_list<value_type> __l)
+      { 
+        size_type __old_size =  _Base::bucket_count();
+        _Base::insert(__l); 
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+      }
+
+      std::pair<iterator, bool>
+      insert(const value_type& __obj)
+      {
+        size_type __old_size = _Base::bucket_count();
+        std::pair<iterator, bool> __res = _Base::insert(__obj);
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+        return __res;
+      }
+
+      iterator
+      insert(const_iterator __iter, const value_type& __v)
+      { 
+        size_type __old_size = _Base::bucket_count(); 
+        iterator __res = _Base::insert(__iter, __v);
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
+      std::pair<iterator, bool>
+      insert(value_type&& __obj)
+      {
+        size_type __old_size = _Base::bucket_count();
+        std::pair<iterator, bool> __res = _Base::insert(std::move(__obj));
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+        return __res;
+      }
+
+      iterator
+      insert(const_iterator __iter, value_type&& __v)
+      { 
+        size_type __old_size = _Base::bucket_count();
+        iterator __res = _Base::insert(__iter, std::move(__v));
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
+      template<typename _InputIter>
+        void
+        insert(_InputIter __first, _InputIter __last)
+        {
+	  size_type __old_size = _Base::bucket_count(); 
+	  _Base::insert(__first, __last);
+	  _M_profile_resize(__old_size,  _Base::bucket_count()); 
+	}
+
+      void
+      insert(const value_type* __first, const value_type* __last)
+      {
+        size_type __old_size = _Base::bucket_count(); 
+        _Base::insert(__first, __last);
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+      }
+     
+      void rehash(size_type __n)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        _Base::rehash(__n);
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+      }
+
+    private:
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+      void
+      _M_profile_resize(size_type __old_size, size_type __new_size)
+      {
+        if (__old_size != __new_size)
+	  __profcxx_hashtable_resize(this, __old_size, __new_size);
+      }
+
+      void
+      _M_profile_destruct()
+      {
+        size_type __hops = 0, __lc = 0, __chain = 0;
+        for (iterator __it = _M_base().begin(); __it != _M_base().end();
+	     ++__it)
+        {
+          while (__it._M_cur_node->_M_next)
+	    {
+	      ++__chain;
+	      ++__it;
+	    }
+
+          if (__chain)
+	    {
+	      ++__chain;
+	      __lc = __lc > __chain ? __lc : __chain;
+	      __hops += __chain * (__chain - 1) / 2;
+	      __chain = 0;
+	    }
+        }
+        __profcxx_hashtable_destruct2(this, __lc,  _Base::size(), __hops);
+      }
+
+   };
+
+  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 bool
+    operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
+#define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc>
+
+  /** @brief Unordered_multiset wrapper with performance instrumentation.  */
+  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_BASE
+    {
+      typedef typename _GLIBCXX_STD_BASE _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 typename _Base::difference_type difference_type;
+      typedef typename _Base::reference       reference;
+      typedef typename _Base::const_reference const_reference;
+
+      typedef typename _Base::iterator iterator;
+      typedef typename _Base::const_iterator 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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      template<typename _InputIterator>
+        unordered_multiset(_InputIterator __f, _InputIterator __l,
+			   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)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      unordered_multiset(const _Base& __x)
+      : _Base(__x)
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      unordered_multiset(unordered_multiset&& __x)
+      : _Base(std::move(__x))
+      {
+        __profcxx_hashtable_construct(this, _Base::bucket_count());
+      }
+
+      unordered_multiset(initializer_list<value_type> __l,
+			 size_type __n = 0,
+			 const hasher& __hf = hasher(),
+			 const key_equal& __eql = key_equal(),
+			 const allocator_type& __a = allocator_type())
+      : _Base(__l, __n, __hf, __eql, __a) { }
+
+      unordered_multiset&
+      operator=(const unordered_multiset& __x)
+      {
+	*static_cast<_Base*>(this) = __x;
+	return *this;
+      }
+
+      unordered_multiset&
+      operator=(unordered_multiset&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      unordered_multiset&
+      operator=(initializer_list<value_type> __l)
+      {
+	this->clear();
+	this->insert(__l);
+	return *this;
+      }
+
+      ~unordered_multiset()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(), 
+                                     _Base::size());
+        _M_profile_destruct();
+      }
+
+      void
+      swap(unordered_multiset& __x)
+      {
+        _Base::swap(__x);
+      }
+
+      void
+      clear()
+      {
+        __profcxx_hashtable_destruct(this, _Base::bucket_count(), 
+                                     _Base::size());
+        _M_profile_destruct();
+        _Base::clear();
+      }
+
+      void
+      insert(std::initializer_list<value_type> __l)
+      { 
+        size_type __old_size =  _Base::bucket_count();
+        _Base::insert(__l); 
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+      }
+
+      iterator
+      insert(const value_type& __obj)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        iterator __res = _Base::insert(__obj);
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+        return __res;
+      }
+
+      iterator
+      insert(const_iterator __iter, const value_type& __v)
+      {
+        size_type __old_size = _Base::bucket_count(); 
+        iterator __res = _Base::insert(__iter, __v);
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
+      iterator
+      insert(value_type&& __obj)
+      {
+	size_type __old_size =  _Base::bucket_count();
+        iterator __res = _Base::insert(std::move(__obj));
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+        return __res;
+      }
+
+      iterator
+      insert(const_iterator __iter, value_type&& __v)
+      {
+        size_type __old_size = _Base::bucket_count(); 
+        iterator __res = _Base::insert(__iter, std::move(__v));
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
+      template<typename _InputIter>
+        void
+        insert(_InputIter __first, _InputIter __last)
+        {
+	  size_type __old_size = _Base::bucket_count(); 
+	  _Base::insert(__first, __last);
+	  _M_profile_resize(__old_size,  _Base::bucket_count()); 
+	}
+
+      void
+      insert(const value_type* __first, const value_type* __last)
+      {
+        size_type __old_size = _Base::bucket_count(); 
+        _Base::insert(__first, __last);
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+      }
+     
+      void rehash(size_type __n)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        _Base::rehash(__n);
+        _M_profile_resize(__old_size,  _Base::bucket_count()); 
+      }
+
+    private:
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+      void
+      _M_profile_resize(size_type __old_size, size_type __new_size)
+      {
+        if (__old_size != __new_size)
+          __profcxx_hashtable_resize(this, __old_size, __new_size);
+      }
+
+      void
+      _M_profile_destruct()
+      {
+        size_type __hops = 0, __lc = 0, __chain = 0;
+        for (iterator __it = _M_base().begin(); __it != _M_base().end();
+	     ++__it)
+        {
+          while (__it._M_cur_node->_M_next)
+	    {
+             ++__chain;
+             ++__it;
+	    }
+
+          if (__chain)
+	    {
+	      ++__chain;
+	      __lc = __lc > __chain ? __lc : __chain;
+	      __hops += __chain * (__chain - 1) / 2;
+	      __chain = 0;
+	    }
+        }
+        __profcxx_hashtable_destruct2(this, __lc,  _Base::size(), __hops);
+      }
+
+   };
+
+  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 bool
+    operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return __x._M_equal(__y); }
+
+  template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+    inline bool
+    operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+    { return !(__x == __y); }
+
+} // namespace __profile
+} // namespace std
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/vector b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/vector
new file mode 100644
index 0000000..3e81c0f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/vector
@@ -0,0 +1,519 @@
+// Profiling vector implementation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/vector
+ *  This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_VECTOR
+#define _GLIBCXX_PROFILE_VECTOR 1
+
+#include <vector>
+#include <utility>
+#include <profile/base.h>
+#include <profile/iterator_tracker.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __profile
+{
+  template<typename _Tp,
+	   typename _Allocator = std::allocator<_Tp> >
+    class vector
+    : public _GLIBCXX_STD_C::vector<_Tp, _Allocator>
+    {
+      typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base;
+
+    public:
+      typedef typename _Base::reference             reference;
+      typedef typename _Base::const_reference       const_reference;
+
+      typedef __iterator_tracker<typename _Base::iterator, vector>
+                                                    iterator;
+      typedef __iterator_tracker<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;
+      
+      _Base&
+      _M_base()       { return *this; }
+
+      const _Base&
+      _M_base() const { return *this; }
+
+      // 23.2.4.1 construct/copy/destroy:
+      explicit
+      vector(const _Allocator& __a = _Allocator())
+      : _Base(__a)
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit
+      vector(size_type __n)
+      :  _Base(__n)
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+
+      vector(size_type __n, const _Tp& __value,
+	     const _Allocator& __a = _Allocator())
+      :  _Base(__n, __value, __a)
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+#else
+      explicit
+      vector(size_type __n, const _Tp& __value = _Tp(),
+	     const _Allocator& __a = _Allocator())
+      :  _Base(__n, __value, __a)
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+#endif
+
+      template<class _InputIterator>
+        vector(_InputIterator __first, _InputIterator __last,
+	       const _Allocator& __a = _Allocator())
+	: _Base(__first, __last, __a)
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+
+      vector(const vector& __x)
+      : _Base(__x) 
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+
+      /// Construction from a release-mode vector
+      vector(const _Base& __x)
+      : _Base(__x) 
+      { 
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      vector(vector&& __x)
+      : _Base(std::move(__x))
+      {
+        __profcxx_vector_construct(this, this->capacity());
+        __profcxx_vector_construct2(this);
+      }
+
+      vector(initializer_list<value_type> __l,
+	     const allocator_type& __a = allocator_type())
+      : _Base(__l, __a) { }
+#endif
+
+      ~vector() {
+        __profcxx_vector_destruct(this, this->capacity(), this->size());
+        __profcxx_vector_destruct2(this);
+      }
+
+      vector&
+      operator=(const vector& __x)
+      {
+        static_cast<_Base&>(*this) = __x;
+        return *this;
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      vector&
+      operator=(vector&& __x)
+      {
+	// NB: DR 1204.
+	// NB: DR 675.
+	this->clear();
+	this->swap(__x);
+	return *this;
+      }
+
+      vector&
+      operator=(initializer_list<value_type> __l)
+      {
+	static_cast<_Base&>(*this) = __l;
+	return *this;
+      }
+#endif
+
+      using _Base::assign;
+      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;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      resize(size_type __sz)
+      {
+        __profcxx_vector_invalid_operator(this);
+        _M_profile_resize(this, this->capacity(), __sz);
+        _Base::resize(__sz);
+      }
+
+      void
+      resize(size_type __sz, const _Tp& __c)
+      {
+        __profcxx_vector_invalid_operator(this);
+        _M_profile_resize(this, this->capacity(), __sz);
+        _Base::resize(__sz, __c);
+      }
+#else
+      void
+      resize(size_type __sz, _Tp __c = _Tp())
+      {
+        __profcxx_vector_invalid_operator(this);
+        _M_profile_resize(this, this->capacity(), __sz);
+        _Base::resize(__sz, __c);
+      }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      using _Base::shrink_to_fit;
+#endif
+
+      using _Base::empty;
+
+      // element access:
+      reference
+      operator[](size_type __n)
+      {
+        __profcxx_vector_invalid_operator(this);
+        return _M_base()[__n];
+      }
+      const_reference
+      operator[](size_type __n) const
+      {
+        __profcxx_vector_invalid_operator(this);
+        return _M_base()[__n];
+      }
+
+      using _Base::at;
+
+      reference
+      front()
+      { 
+        return _Base::front();
+      }
+
+      const_reference
+      front() const
+      {
+	return _Base::front();
+      }
+
+      reference
+      back()
+      {
+	return _Base::back();
+      }
+
+      const_reference
+      back() const
+      {
+	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)
+      {
+        size_type __old_size = this->capacity();
+	_Base::push_back(__x);
+        _M_profile_resize(this, __old_size, this->capacity());
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      push_back(_Tp&& __x)
+      {
+        size_type __old_size = this->capacity();
+        _Base::push_back(__x);
+        _M_profile_resize(this, __old_size, this->capacity());
+      }
+
+#endif
+
+      iterator
+      insert(iterator __position, const _Tp& __x)
+      {
+        __profcxx_vector_insert(this, __position.base() - _Base::begin(),
+                                this->size());
+        size_type __old_size = this->capacity();
+	typename _Base::iterator __res = _Base::insert(__position.base(), __x);
+        _M_profile_resize(this, __old_size, this->capacity());
+	return iterator(__res, this);
+      }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(iterator __position, _Tp&& __x)
+      {
+        __profcxx_vector_insert(this, __position.base() - _Base::begin(),
+                                this->size());
+        size_type __old_size = this->capacity();
+	typename _Base::iterator __res = _Base::insert(__position.base(), __x);
+        _M_profile_resize(this, __old_size, this->capacity());
+	return iterator(__res, this);
+      }
+
+      void
+      insert(iterator __position, initializer_list<value_type> __l)
+      { this->insert(__position, __l.begin(), __l.end()); }
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      void
+      swap(vector&& __x)
+      {
+        _Base::swap(__x);
+      }
+#endif
+
+      void
+      swap(vector& __x)
+      {
+        _Base::swap(__x);
+      }
+
+      void
+      insert(iterator __position, size_type __n, const _Tp& __x)
+      {
+        __profcxx_vector_insert(this, __position.base() - _Base::begin(),
+                                this->size());
+        size_type __old_size = this->capacity();
+        _Base::insert(__position, __n, __x);
+        _M_profile_resize(this, __old_size, this->capacity());
+      }
+
+      template<class _InputIterator>
+      void
+      insert(iterator __position,
+             _InputIterator __first, _InputIterator __last)
+      {
+        __profcxx_vector_insert(this, __position.base()-_Base::begin(),
+                                this->size());
+        size_type __old_size = this->capacity();
+        _Base::insert(__position, __first, __last);
+        _M_profile_resize(this, __old_size, this->capacity());
+      }
+
+
+      iterator
+      erase(iterator __position)
+      {
+	typename _Base::iterator __res = _Base::erase(__position.base());
+	return iterator(__res, this);
+      }
+
+      iterator
+      erase(iterator __first, iterator __last)
+      {
+	// _GLIBCXX_RESOLVE_LIB_DEFECTS
+	// 151. can't currently clear() empty container
+	typename _Base::iterator __res = _Base::erase(__first.base(),
+                                                      __last.base());
+	return iterator(__res, this);
+      }
+
+      void
+      clear()
+      {
+        __profcxx_vector_destruct(this, this->capacity(), this->size());
+        __profcxx_vector_destruct2(this);
+        _Base::clear();
+      }
+
+      inline void _M_profile_find() const 
+      { 
+        __profcxx_vector_find(this, size()); 
+      }
+
+      inline void _M_profile_iterate(int __rewind = 0) const 
+      { 
+        __profcxx_vector_iterate(this); 
+      }
+
+    private:
+      void _M_profile_resize(void* obj, size_type __old_size, 
+                             size_type __new_size)
+      {
+        if (__old_size < __new_size) {
+          __profcxx_vector_resize(this, this->size(), __new_size);
+          __profcxx_vector_resize2(this, this->size(), __new_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 __profile
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  // DR 1182.
+  /// std::hash specialization for vector<bool>.
+  template<typename _Alloc>
+    struct hash<__profile::vector<bool, _Alloc>>
+    : public __hash_base<size_t, __profile::vector<bool, _Alloc>>
+    {
+      size_t
+      operator()(const __profile::vector<bool, _Alloc>& __b) const noexcept
+      { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()
+	  (__b._M_base()); }
+    };
+#endif
+
+} // namespace std
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/queue b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/queue
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/queue
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/queue
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/random b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/random
new file mode 100644
index 0000000..59aed8e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/random
@@ -0,0 +1,57 @@
+// <random> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <iosfwd>
+#include <limits>
+#include <debug/debug.h>
+#include <type_traits>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+#include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t
+#include <bits/random.h>
+#include <bits/random.tcc>
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_RANDOM
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ratio b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ratio
new file mode 100644
index 0000000..17d28a1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/ratio
@@ -0,0 +1,393 @@
+// ratio -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the 
+// terms of the GNU General Public License as published by the 
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ratio
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_RATIO
+#define _GLIBCXX_RATIO 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <type_traits>
+#include <cstdint>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup ratio Rational Arithmetic
+   * @ingroup utilities
+   *
+   * Compile time representation of finite 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 constexpr intmax_t num =
+        _Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value;
+
+      static constexpr intmax_t den =
+        __static_abs<_Den>::value / __static_gcd<_Num, _Den>::value;
+
+      typedef ratio<num, den> type;
+    };
+
+  template<intmax_t _Num, intmax_t _Den>
+    constexpr intmax_t ratio<_Num, _Den>::num;
+
+  template<intmax_t _Num, intmax_t _Den>
+    constexpr intmax_t ratio<_Num, _Den>::den;
+
+  /// ratio_add
+  template<typename _R1, typename _R2>
+    struct ratio_add
+    {
+    private:
+      static constexpr intmax_t __gcd =
+        __static_gcd<_R1::den, _R2::den>::value;
+      static constexpr intmax_t __n = __safe_add<
+        __safe_multiply<_R1::num, (_R2::den / __gcd)>::value,
+        __safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value;
+
+      // The new numerator may have common factors with the denominator,
+      // but they have to also be factors of __gcd.
+      static constexpr intmax_t __gcd2 = __static_gcd<__n, __gcd>::value;
+      
+    public:
+      typedef ratio<__n / __gcd2,
+        __safe_multiply<_R1::den / __gcd2, _R2::den / __gcd>::value> type;
+
+      static constexpr intmax_t num = type::num;
+      static constexpr intmax_t den = type::den;
+    };
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_add<_R1, _R2>::num;
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_add<_R1, _R2>::den;
+
+  /// ratio_subtract
+  template<typename _R1, typename _R2>
+    struct ratio_subtract
+    {
+      typedef typename ratio_add<
+        _R1,
+        ratio<-_R2::num, _R2::den>>::type type;
+
+      static constexpr intmax_t num = type::num;
+      static constexpr intmax_t den = type::den;
+    };
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_subtract<_R1, _R2>::num;
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_subtract<_R1, _R2>::den;
+
+  /// 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;
+
+      static constexpr intmax_t num = type::num;
+      static constexpr intmax_t den = type::den;
+    };
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_multiply<_R1, _R2>::num;
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_multiply<_R1, _R2>::den;
+
+  /// 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;
+
+      static constexpr intmax_t num = type::num;
+      static constexpr intmax_t den = type::den;
+    };
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_divide<_R1, _R2>::num;
+
+  template<typename _R1, typename _R2>
+    constexpr intmax_t ratio_divide<_R1, _R2>::den;
+
+  /// 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>
+    { };
+
+  // 0 <= _Ri < 1
+  // If one is 0, conclude
+  // Otherwise, x < y iff 1/y < 1/x
+  template<typename _R1, typename _R2>
+    struct __ratio_less_impl_2;
+
+  // _Ri > 0
+  // Compare the integral parts, and remove them if they are equal
+  template<typename _R1, typename _R2, intmax_t __q1 = _R1::num / _R1::den,
+           intmax_t __q2 = _R2::num / _R2::den, bool __eq = (__q1 == __q2)>
+    struct __ratio_less_impl_1
+    : __ratio_less_impl_2<ratio<_R1::num % _R1::den, _R1::den>,
+           ratio<_R2::num % _R2::den, _R2::den> >::type
+    { }; 
+
+  template<typename _R1, typename _R2, intmax_t __q1, intmax_t __q2>
+    struct __ratio_less_impl_1<_R1, _R2, __q1, __q2, false>
+    : integral_constant<bool, (__q1 < __q2) >
+    { };
+
+  template<typename _R1, typename _R2>
+    struct __ratio_less_impl_2
+    : __ratio_less_impl_1<ratio<_R2::den, _R2::num>,
+           ratio<_R1::den, _R1::num> >::type
+    { }; 
+
+  template<intmax_t __d1, typename _R2>
+    struct __ratio_less_impl_2<ratio<0, __d1>, _R2>
+    : integral_constant<bool, true>
+    { }; 
+
+  template<typename _R1, intmax_t __d2>
+    struct __ratio_less_impl_2<_R1, ratio<0, __d2> >
+    : integral_constant<bool, false>
+    { }; 
+
+  template<intmax_t __d1, intmax_t __d2>
+    struct __ratio_less_impl_2<ratio<0, __d1>, ratio<0, __d2> >
+    : integral_constant<bool, false>
+    { }; 
+
+  template<typename _R1, typename _R2,
+	   bool = (_R1::num == 0 || _R2::num == 0
+		   || (__static_sign<_R1::num>::value
+		       != __static_sign<_R2::num>::value)),
+	   bool = (__static_sign<_R1::num>::value == -1
+		   && __static_sign<_R2::num>::value == -1)>
+    struct __ratio_less_impl
+    : __ratio_less_impl_1<_R1, _R2>::type
+    { };
+
+  template<typename _R1, typename _R2>
+    struct __ratio_less_impl<_R1, _R2, true, false>
+    : integral_constant<bool, _R1::num < _R2::num>
+    { };
+
+  template<typename _R1, typename _R2>
+    struct __ratio_less_impl<_R1, _R2, false, true>
+    : __ratio_less_impl_1<ratio<-_R2::num, _R2::den>,
+           ratio<-_R1::num, _R1::den> >::type
+    { };
+
+  /// ratio_less
+  // using a continued fraction expansion
+  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
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif //_GLIBCXX_USE_C99_STDINT_TR1
+
+#endif //__GXX_EXPERIMENTAL_CXX0X__
+
+#endif //_GLIBCXX_RATIO
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/regex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/regex
new file mode 100644
index 0000000..eabb843
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/regex
@@ -0,0 +1,66 @@
+// <regex> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <algorithm>
+#include <bitset>
+#include <functional>
+#ifdef _GLIBCXX_DEBUG
+# include <iosfwd>
+#endif
+#include <iterator>
+#include <locale>
+#include <memory>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <bits/range_access.h>
+#include <bits/regex_constants.h>
+#include <bits/regex_error.h>
+#include <bits/regex_cursor.h>
+#include <bits/regex_nfa.h>
+#include <bits/regex_compiler.h>
+#include <bits/regex_grep_matcher.h>
+#include <bits/regex.h>
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_REGEX
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/set
new file mode 100644
index 0000000..52fcbaa
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/set
@@ -0,0 +1,73 @@
+// <set> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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>
+#include <bits/range_access.h>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/set>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/set>
+#endif
+
+#endif /* _GLIBCXX_SET */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/sstream b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/sstream
new file mode 100644
index 0000000..bf2862a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/sstream
@@ -0,0 +1,582 @@
+// String based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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.
+       *
+       *  <em>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.</em> [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());
+	  }
+      }
+
+      // Works around the issue with pbump, part of the protected
+      // interface of basic_streambuf, taking just an int.
+      void
+      _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off);
+    };
+
+
+  // [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_VERSION
+} // namespace
+
+#include <bits/sstream.tcc>
+
+#endif /* _GLIBCXX_SSTREAM */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/stack b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/stack
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/stack
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/stack
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/stdexcept b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/stdexcept
new file mode 100644
index 0000000..a461795
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/stdexcept
@@ -0,0 +1,159 @@
+// Standard exception classes  -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2005, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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);
+    virtual ~domain_error() throw();
+  };
+
+  /** Thrown to report invalid arguments to functions.  */
+  class invalid_argument : public logic_error 
+  {
+  public:
+    explicit invalid_argument(const string& __arg);
+    virtual ~invalid_argument() throw();
+  };
+
+  /** 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);
+    virtual ~length_error() throw();
+  };
+
+  /** 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);
+    virtual ~out_of_range() throw();
+  };
+
+  /** 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);
+    virtual ~range_error() throw();
+  };
+
+  /** Thrown to indicate arithmetic overflow.  */
+  class overflow_error : public runtime_error 
+  {
+  public:
+    explicit overflow_error(const string& __arg);
+    virtual ~overflow_error() throw();
+  };
+
+  /** Thrown to indicate arithmetic underflow.  */
+  class underflow_error : public runtime_error 
+  {
+  public:
+    explicit underflow_error(const string& __arg);
+    virtual ~underflow_error() throw();
+  };
+
+  // @} group exceptions
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _GLIBCXX_STDEXCEPT */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/streambuf b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/streambuf
new file mode 100644
index 0000000..b46efec
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/streambuf
@@ -0,0 +1,810 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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).
+   *  @ingroup io
+   *
+   *  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 <em>the stream position</em> 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 <em>the previous character.</em> 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 @a unget
+       *  the last character @a 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,
+       *  <em>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.</em>
+       *
+       *  @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 @a 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.
+       *
+       *  <em>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.</em> [27.5.2.4.3]/1
+       *
+       *  @note  Base class version does nothing, returns zero.
+       *  @note  The standard adds that <em>the intention is not only that the
+       *         calls [to underflow or uflow] will not return @c eof() but
+       *         that they will return immediately.</em>
+       *  @note  The standard adds that <em>the morphemes of @c showmanyc are
+       *         @b es-how-many-see, not @b show-manic.</em>
+      */
+      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 @a 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, <em>some other value</em> 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 @a consumed, with
+       *  <em>some effect</em> 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_USE_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
+
+      // Also used by specializations for char and wchar_t in src.
+      void 
+      __safe_gbump(streamsize __n) { _M_in_cur += __n; }
+
+      void
+      __safe_pbump(streamsize __n) { _M_out_cur += __n; }
+
+    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_VERSION
+} // namespace
+
+#include <bits/streambuf.tcc>
+
+#endif /* _GLIBCXX_STREAMBUF */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/string b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/string
new file mode 100644
index 0000000..2893396
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/string
@@ -0,0 +1,57 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/range_access.h>
+#include <bits/basic_string.h>
+#include <bits/basic_string.tcc> 
+
+#endif /* _GLIBCXX_STRING */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/system_error b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/system_error
new file mode 100644
index 0000000..6ef070a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/system_error
@@ -0,0 +1,376 @@
+// <system_error> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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 <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <bits/error_constants.h>
+#include <iosfwd>
+#include <stdexcept>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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 { };
+
+  /// 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();
+
+  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.
+  _GLIBCXX_CONST const error_category& system_category() throw();
+  _GLIBCXX_CONST const error_category& generic_category() throw();
+
+  error_code make_error_code(errc);
+
+  template<typename _Tp>
+    struct hash;
+
+  /// 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)
+      { *this = make_error_code(__e); }
+
+    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)
+      { return *this = make_error_code(__e); }
+
+    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()); }
+
+    explicit operator bool() const
+    { return _M_value != 0 ? true : false; }
+
+    // DR 804.
+  private:
+    friend class hash<error_code>;
+
+    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 make_error_condition(errc);
+
+  /// 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)
+      { *this = make_error_condition(__e); }
+
+    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)
+      { return *this = make_error_condition(__e); }
+
+    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()); }
+
+    explicit operator bool() const
+    { return _M_value != 0 ? true : 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(__ec.message()), _M_code(__ec) { }
+
+    system_error(error_code __ec, const string& __what)
+    : runtime_error(__what + ": " + __ec.message()), _M_code(__ec) { }
+
+    /*
+     * TODO: Add const char* ctors to all exceptions.
+     *
+     * system_error(error_code __ec, const char* __what)
+     * : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { }
+     *
+     * system_error(int __v, const error_category& __ecat, const char* __what)
+     * : runtime_error(__what + (": " + __ec.message())),
+     *   _M_code(error_code(__v, __ecat)) { }
+     */
+
+    system_error(int __v, const error_category& __ecat)
+    : runtime_error(error_code(__v, __ecat).message()),
+      _M_code(__v, __ecat) { }
+
+    system_error(int __v, const error_category& __ecat, const string& __what)
+    : runtime_error(__what + ": " + error_code(__v, __ecat).message()),
+      _M_code(__v, __ecat) { }
+
+    virtual ~system_error() throw();
+
+    const error_code& 
+    code() const throw() { return _M_code; }
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
+
+#include <bits/functional_hash.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // DR 1182.
+  /// std::hash specialization for error_code.
+  template<>
+    struct hash<error_code>
+    : public __hash_base<size_t, error_code>
+    {
+      size_t
+      operator()(const error_code& __e) const noexcept
+      {
+	const size_t __tmp = std::_Hash_impl::hash(__e._M_value);
+	return std::_Hash_impl::__hash_combine(__e._M_cat, __tmp);
+      }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // _GLIBCXX_COMPATIBILITY_CXX0X
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_SYSTEM_ERROR
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tgmath.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tgmath.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/thread b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/thread
new file mode 100644
index 0000000..bd102fc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/thread
@@ -0,0 +1,301 @@
+// <thread> -*- C++ -*-
+
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/thread
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_THREAD
+#define _GLIBCXX_THREAD 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <chrono>
+#include <functional>
+#include <memory>
+#include <mutex>
+#include <condition_variable>
+#include <bits/functexcept.h>
+#include <bits/functional_hash.h>
+#include <bits/gthr.h>
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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 class hash<thread::id>;
+
+      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;
+
+      inline virtual ~_Impl_base();
+
+      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(thread&) = delete;
+    thread(const thread&) = delete;
+
+    thread(thread&& __t)
+    { swap(__t); }
+
+    template<typename _Callable, typename... _Args>
+      explicit 
+      thread(_Callable&& __f, _Args&&... __args)
+      {
+        _M_start_thread(_M_make_routine(std::bind<void>(
+                std::forward<_Callable>(__f),
+                std::forward<_Args>(__args)...)));
+      }
+
+    ~thread()
+    {
+      if (joinable())
+	std::terminate();
+    }
+
+    thread& operator=(const thread&) = delete;
+
+    thread& operator=(thread&& __t)
+    {
+      if (joinable())
+	std::terminate();
+      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 thread::_Impl_base::~_Impl_base() = default;
+
+  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); }
+
+  // DR 889.
+  /// std::hash specialization for thread::id.
+  template<>
+    struct hash<thread::id>
+    : public __hash_base<size_t, thread::id>
+    {
+      size_t
+      operator()(const thread::id& __id) const noexcept
+      { return std::_Hash_impl::hash(__id._M_thread); }
+    };
+
+  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;
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+
+  /** @namespace std::this_thread
+   *  @brief ISO C++ 0x entities sub namespace for thread.
+   *  30.2.2 Namespace this_thread.
+   */
+  namespace this_thread
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /// 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
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  }
+
+  // @} group threads
+
+} // namespace
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_THREAD
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/array b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/array
new file mode 100644
index 0000000..058fcfa
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/array
@@ -0,0 +1,252 @@
+// class template array -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <bits/stl_algobase.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   *  @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
+      assign(const value_type& __u)
+      { std::fill_n(begin(), size(), __u); }
+
+      void
+      swap(array& __other)
+      { std::swap_ranges(begin(), end(), __other.begin()); }
+
+      // Iterators.
+      iterator
+      begin()
+      { return iterator(std::__addressof(_M_instance[0])); }
+
+      const_iterator
+      begin() const 
+      { return const_iterator(std::__addressof(_M_instance[0])); }
+
+      iterator
+      end()
+      { return iterator(std::__addressof(_M_instance[_Nm])); }
+
+      const_iterator
+      end() const
+      { return const_iterator(std::__addressof(_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()); }
+
+      // 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 (__n >= _Nm)
+	  std::__throw_out_of_range(__N("array::at"));
+	return _M_instance[__n];
+      }
+
+      const_reference
+      at(size_type __n) const
+      {
+	if (__n >= _Nm)
+	  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 std::__addressof(_M_instance[0]); }
+
+      const _Tp*
+      data() const
+      { return std::__addressof(_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)
+    { __one.swap(__two); }
+
+  // Tuple interface to class template array [6.2.2.5].
+
+  /// tuple_size
+  template<typename _Tp> 
+    class tuple_size;
+
+  /// tuple_element
+  template<int _Int, typename _Tp>
+    class tuple_element;
+
+  template<typename _Tp, std::size_t _Nm>
+    struct tuple_size<array<_Tp, _Nm> >
+    { static const int value = _Nm; };
+
+  template<typename _Tp, std::size_t _Nm>
+    const int
+    tuple_size<array<_Tp, _Nm> >::value;  
+
+  template<int _Int, typename _Tp, std::size_t _Nm>
+    struct tuple_element<_Int, array<_Tp, _Nm> >
+    { typedef _Tp type; };
+
+  template<int _Int, typename _Tp, std::size_t _Nm>
+    inline _Tp&
+    get(array<_Tp, _Nm>& __arr)
+    { return __arr[_Int]; }
+
+  template<int _Int, typename _Tp, std::size_t _Nm>
+    inline const _Tp&
+    get(const array<_Tp, _Nm>& __arr)
+    { return __arr[_Int]; }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_ARRAY
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/bessel_function.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/bessel_function.tcc
new file mode 100644
index 0000000..b525ebc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/bessel_function.tcc
@@ -0,0 +1,628 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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;
+        }
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_BESSEL_FUNCTION_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/beta_function.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/beta_function.tcc
new file mode 100644
index 0000000..219f3cb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/beta_function.tcc
@@ -0,0 +1,198 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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);
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // __GLIBCXX_TR1_BETA_FUNCTION_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ccomplex
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ccomplex
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cctype b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cctype
new file mode 100644
index 0000000..0cec3d9
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cctype
@@ -0,0 +1,49 @@
+// TR1 cctype -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+
+#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
+
+#undef isblank
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  using ::isblank;
+}
+}
+
+#endif
+
+#endif // _GLIBCXX_TR1_CCTYPE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfenv b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfenv
new file mode 100644
index 0000000..980a06c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfenv
@@ -0,0 +1,81 @@
+// TR1 cfenv -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#ifdef _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_VISIBILITY(default)
+{
+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;
+}
+}
+
+#endif // _GLIBCXX_USE_C99_FENV_TR1
+
+#endif // _GLIBCXX_TR1_CFENV
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfloat
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfloat
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cinttypes b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cinttypes
new file mode 100644
index 0000000..f1ca292
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cinttypes
@@ -0,0 +1,84 @@
+// TR1 cinttypes -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+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
+}
+}
+
+#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
+
+#endif // _GLIBCXX_TR1_CINTTYPES
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/climits
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/climits
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cmath b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cmath
new file mode 100644
index 0000000..9ada637
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cmath
@@ -0,0 +1,1473 @@
+// TR1 cmath -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <cmath>
+
+#ifdef _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_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+#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].
+  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));
+    }
+
+#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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    acosh(_Tp __x)
+    { return __builtin_acosh(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    asinh(_Tp __x)
+    { return __builtin_asinh(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    atanh(_Tp __x)
+    { return __builtin_atanh(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    cbrt(_Tp __x)
+    { return __builtin_cbrt(__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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    erf(_Tp __x)
+    { return __builtin_erf(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    erfc(_Tp __x)
+    { return __builtin_erfc(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    exp2(_Tp __x)
+    { return __builtin_exp2(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    expm1(_Tp __x)
+    { return __builtin_expm1(__x); }
+
+  // Note: we deal with fabs in a special way, because an using std::fabs
+  // would bring in also the overloads for complex types, which in C++0x
+  // mode have a different return type.
+  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); }
+
+  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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value
+				    && __is_arithmetic<_Vp>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _Up>::__type
+    hypot(_Tp __y, _Up __x)
+    {
+      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+      return hypot(__type(__y), __type(__x));
+    }
+
+  inline int
+  ilogb(float __x)
+  { return __builtin_ilogbf(__x); }
+
+  inline int
+  ilogb(long double __x)
+  { return __builtin_ilogbl(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   int>::__type
+    ilogb(_Tp __x)
+    { return __builtin_ilogb(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    lgamma(_Tp __x)
+    { return __builtin_lgamma(__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 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long long>::__type
+    llrint(_Tp __x)
+    { return __builtin_llrint(__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 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long long>::__type
+    llround(_Tp __x)
+    { return __builtin_llround(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    log1p(_Tp __x)
+    { return __builtin_log1p(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    log2(_Tp __x)
+    { return __builtin_log2(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    logb(_Tp __x)
+    {
+      return __builtin_logb(__x);
+    }
+
+  inline long
+  lrint(float __x)
+  { return __builtin_lrintf(__x); }
+
+  inline long
+  lrint(long double __x)
+  { return __builtin_lrintl(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long>::__type
+    lrint(_Tp __x)
+    { return __builtin_lrint(__x); }
+
+  inline long
+  lround(float __x)
+  { return __builtin_lroundf(__x); }
+
+  inline long
+  lround(long double __x)
+  { return __builtin_lroundl(__x); }
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
+					   long>::__type
+    lround(_Tp __x)
+    { return __builtin_lround(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    nearbyint(_Tp __x)
+    { return __builtin_nearbyint(__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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    nexttoward(_Tp __x, long double __y)
+    { return __builtin_nexttoward(__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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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<
+    typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+				    && __is_arithmetic<_Up>::__value,
+				    _Tp>::__type, _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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    rint(_Tp __x)
+    { return __builtin_rint(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    round(_Tp __x)
+    { return __builtin_round(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    scalbln(_Tp __x, long __ex)
+    { return __builtin_scalbln(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    scalbn(_Tp __x, int __ex)
+    { return __builtin_scalbn(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    tgamma(_Tp __x)
+    { return __builtin_tgamma(__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::__enable_if<__is_integer<_Tp>::__value, 
+					   double>::__type
+    trunc(_Tp __x)
+    { return __builtin_trunc(__x); }
+
+#endif
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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));
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_CMATH
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex
new file mode 100644
index 0000000..689ea16
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex
@@ -0,0 +1,419 @@
+// TR1 complex -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <complex>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup complex_numbers
+   * @{
+   */
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  using std::acos;
+  using std::asin;
+  using std::atan;
+#else
+  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>&);
+#endif
+
+  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>&);
+
+  // The std::fabs return type in C++0x mode is different (just _Tp).
+  template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&);
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp>
+    inline std::complex<_Tp>
+    __complex_acos(const std::complex<_Tp>& __z)
+    {
+      const std::complex<_Tp> __t = std::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::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
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+  template<typename _Tp>
+    std::complex<_Tp>
+    __complex_acosh(const std::complex<_Tp>& __z)
+    {
+      // Kahan's formula.
+      return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0)))
+				 + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
+    }
+
+#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>
+    inline std::complex<_Tp>
+    /// 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].
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+
+  template<typename _Tp>
+    inline typename __gnu_cxx::__promote<_Tp>::__type
+    arg(_Tp __x)
+    {
+      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
+      return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
+	                       : __type();
+#else
+      return std::arg(std::complex<__type>(__x));
+#endif
+    }
+
+  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));
+    }
+
+  using std::arg;
+
+  template<typename _Tp>
+    inline std::complex<_Tp>
+    conj(const std::complex<_Tp>& __z)
+    { return std::conj(__z); }  
+
+  template<typename _Tp>
+    inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
+    conj(_Tp __x)
+    { return __x; }
+
+  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); }
+
+// @} group complex_numbers
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_COMPLEX
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdarg
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdarg
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdbool
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdbool
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdint b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdint
new file mode 100644
index 0000000..55ce4bc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdint
@@ -0,0 +1,104 @@
+// TR1 cstdint -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#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
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+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;
+}
+}
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // _GLIBCXX_TR1_CSTDINT
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdio b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdio
new file mode 100644
index 0000000..415e8a4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdio
@@ -0,0 +1,53 @@
+// TR1 cstdio -*- C++ -*-
+
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <cstdio>
+
+#if _GLIBCXX_USE_C99
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  using std::snprintf;
+  using std::vsnprintf;
+
+  using std::vfscanf;
+  using std::vscanf;
+  using std::vsscanf;
+}
+}
+
+#endif
+
+#endif // _GLIBCXX_TR1_CSTDIO
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdlib b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdlib
new file mode 100644
index 0000000..6e3e16d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdlib
@@ -0,0 +1,72 @@
+// TR1 cstdlib -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <cstdlib>
+
+#if _GLIBCXX_HOSTED
+
+#if _GLIBCXX_USE_C99
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+#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_USE_C99 
+
+#endif // _GLIBCXX_HOSTED
+
+#endif // _GLIBCXX_TR1_CSTDLIB
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctgmath
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctgmath
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctime
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctime
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctype.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctype.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwchar b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwchar
new file mode 100644
index 0000000..8bf775b
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwchar
@@ -0,0 +1,65 @@
+// TR1 cwchar -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <cwchar>
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+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
+}
+}
+
+#endif // _GLIBCXX_USE_WCHAR_T
+
+#endif // _GLIBCXX_TR1_CWCHAR
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwctype b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwctype
new file mode 100644
index 0000000..452a7b4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwctype
@@ -0,0 +1,50 @@
+// TR1 cwctype -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <cwctype>
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+#if _GLIBCXX_HAVE_ISWBLANK
+  using std::iswblank;
+#endif  
+}
+}
+
+#endif // _GLIBCXX_USE_WCHAR_T
+
+#endif // _GLIBCXX_TR1_CWCTYPE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ell_integral.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ell_integral.tcc
new file mode 100644
index 0000000..4dfe616
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ell_integral.tcc
@@ -0,0 +1,751 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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);
+        }
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_ELL_INTEGRAL_TCC
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/exp_integral.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/exp_integral.tcc
new file mode 100644
index 0000000..cf3bd63
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/exp_integral.tcc
@@ -0,0 +1,525 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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 = -__numeric_constants<_Tp>::gamma_e();
+              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);
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_EXP_INTEGRAL_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/fenv.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/fenv.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/float.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/float.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional
new file mode 100644
index 0000000..31e72d6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional
@@ -0,0 +1,2149 @@
+// TR1 functional header -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#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>
+#include <bits/move.h> // for std::__addressof
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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(std::__addressof(__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 { };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+
+  /** @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 
+  { 
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+    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;
+    } 
+  _GLIBCXX_END_NAMESPACE_VERSION
+  }
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+  /**
+   *  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(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:
+	  typedef typename add_reference<__base_type>::type type;
+	};
+
+      template<typename _Tuple>
+        typename result<_Mu(_Arg, _Tuple)>::type
+        operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile
+        {
+	  return ::std::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)>
+        {
+	  typedef typename add_reference<_CVArg>::type type;
+	};
+
+      // 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>()
+                      (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>()
+                      (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>()
+                      (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>()
+                      (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(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(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(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(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>()
+                      (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>()
+                      (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>()
+                      (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>()
+                      (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(tr1::tie(__args...), _Bound_indexes());
+        }
+
+      // Call as const
+      template<typename... _Args>
+        result_type
+        operator()(_Args&... __args) const
+        {
+          return this->__call(tr1::tie(__args...), _Bound_indexes());
+        }
+
+      // Call as volatile
+      template<typename... _Args>
+        result_type
+        operator()(_Args&... __args) volatile
+        {
+          return this->__call(tr1::tie(__args...), _Bound_indexes());
+        }
+
+      // Call as const volatile
+      template<typename... _Args>
+        result_type
+        operator()(_Args&... __args) const volatile
+        {
+          return this->__call(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.
+   *  @ingroup exceptions
+   */
+  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 @a 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 static_cast<bool>(__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 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)
+      {
+	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
+    {
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+      /// 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;
+#endif
+
+      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.
+       *  @post @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 @c *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)
+      {
+	std::swap(_M_functor, __x._M_functor);
+	std::swap(_M_manager, __x._M_manager);
+	std::swap(_M_invoker, __x._M_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.
+       */
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      explicit operator bool() const
+      { return !_M_empty(); }
+#else
+      operator _Safe_bool() const
+      {
+        if (_M_empty())
+	  return 0;
+	else
+	  return &_Hidden_type::_M_bool;
+      }
+#endif
+
+      // [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 (static_cast<bool>(__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 !static_cast<bool>(__f); }
+
+  /// @overload
+  template<typename _Signature>
+    inline bool
+    operator==(_M_clear_type*, const function<_Signature>& __f)
+    { return !static_cast<bool>(__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 static_cast<bool>(__f); }
+
+  /// @overload
+  template<typename _Signature>
+    inline bool
+    operator!=(_M_clear_type*, const function<_Signature>& __f)
+    { return static_cast<bool>(__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_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_FUNCTIONAL
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional_hash.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional_hash.h
new file mode 100644
index 0000000..1742e15
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional_hash.h
@@ -0,0 +1,196 @@
+// TR1 functional_hash.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/functional}
+ */
+
+#ifndef _GLIBCXX_TR1_FUNCTIONAL_HASH_H
+#define _GLIBCXX_TR1_FUNCTIONAL_HASH_H 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// 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);
+  _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>
+    struct _Fnv_hash_base
+    {
+      template<typename _Tp>
+        static size_t
+        hash(const _Tp* __ptr, size_t __clength)
+        {
+	  size_t __result = 0;
+	  const char* __cptr = reinterpret_cast<const char*>(__ptr);
+	  for (; __clength; --__clength)
+	    __result = (__result * 131) + *__cptr++;
+	  return __result;
+	}
+    };
+
+  template<>
+    struct _Fnv_hash_base<4>
+    {
+      template<typename _Tp>
+        static size_t
+        hash(const _Tp* __ptr, size_t __clength)
+        {
+	  size_t __result = static_cast<size_t>(2166136261UL);
+	  const char* __cptr = reinterpret_cast<const char*>(__ptr);
+	  for (; __clength; --__clength)
+	    {
+	      __result ^= static_cast<size_t>(*__cptr++);
+	      __result *= static_cast<size_t>(16777619UL);
+	    }
+	  return __result;
+	}
+    };
+  
+  template<>
+    struct _Fnv_hash_base<8>
+    {
+      template<typename _Tp>
+        static size_t
+        hash(const _Tp* __ptr, size_t __clength)
+        {
+	  size_t __result
+	    = static_cast<size_t>(14695981039346656037ULL);
+	  const char* __cptr = reinterpret_cast<const char*>(__ptr);
+	  for (; __clength; --__clength)
+	    {
+	      __result ^= static_cast<size_t>(*__cptr++);
+	      __result *= static_cast<size_t>(1099511628211ULL);
+	    }
+	  return __result;
+	}
+    };
+
+  struct _Fnv_hash
+  : public _Fnv_hash_base<sizeof(size_t)>
+  {
+    using _Fnv_hash_base<sizeof(size_t)>::hash;
+
+    template<typename _Tp>
+      static size_t
+      hash(const _Tp& __val)
+      { return hash(&__val, sizeof(__val)); }
+  };
+
+  /// Explicit specializations for float.
+  template<>
+    inline size_t
+    hash<float>::operator()(float __val) const
+    {
+      // 0 and -0 both hash to zero.
+      return __val != 0.0f ? std::tr1::_Fnv_hash::hash(__val) : 0;
+    }
+
+  /// Explicit specializations for double.
+  template<>
+    inline size_t
+    hash<double>::operator()(double __val) const
+    {
+      // 0 and -0 both hash to zero.
+      return __val != 0.0 ? std::tr1::_Fnv_hash::hash(__val) : 0;
+    }
+
+  /// Explicit specializations for long double.
+  template<>
+    _GLIBCXX_PURE size_t
+    hash<long double>::operator()(long double __val) const;
+
+  /// Explicit specialization of member operator for non-builtin types.
+  template<>
+    _GLIBCXX_PURE size_t
+    hash<string>::operator()(string) const;
+
+  template<>
+    _GLIBCXX_PURE size_t
+    hash<const string&>::operator()(const string&) const;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  template<>
+    _GLIBCXX_PURE size_t
+    hash<wstring>::operator()(wstring) const;
+
+  template<>
+    _GLIBCXX_PURE size_t
+    hash<const wstring&>::operator()(const wstring&) const;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_FUNCTIONAL_HASH_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/gamma.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/gamma.tcc
new file mode 100644
index 0000000..a7c399c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/gamma.tcc
@@ -0,0 +1,473 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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_GAMMA_TCC
+#define _GLIBCXX_TR1_GAMMA_TCC 1
+
+#include "special_function_util.h"
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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;
+        }
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_GAMMA_TCC
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable.h
new file mode 100644
index 0000000..5d1e02c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable.h
@@ -0,0 +1,1181 @@
+// TR1 hashtable.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly.
+ *  @headername{tr1/unordered_set, tr1/unordered_map}
+ */
+
+#ifndef _GLIBCXX_TR1_HASHTABLE_H
+#define _GLIBCXX_TR1_HASHTABLE_H 1
+
+#pragma GCC system_header
+
+#include <tr1/hashtable_policy.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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&);
+
+      _Hashtable&
+      operator=(const _Hashtable&);
+
+      ~_Hashtable();
+
+      void swap(_Hashtable&);
+
+      // 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); }
+
+      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); }
+
+      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::tr1::true_type);
+
+      iterator
+      _M_insert(const value_type&, std::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::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);
+
+      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
+	{
+	  _M_get_Value_allocator().construct(&__n->_M_v, __v);
+	  __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)
+    {
+      _M_get_Value_allocator().destroy(&__n->_M_v);
+      _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;
+	}
+    }
+
+  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>::
+    swap(_Hashtable& __x)
+    {
+      // 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::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::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_VERSION
+} // namespace tr1
+} // namespace std
+
+#endif // _GLIBCXX_TR1_HASHTABLE_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable_policy.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable_policy.h
new file mode 100644
index 0000000..82f8fde
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable_policy.h
@@ -0,0 +1,783 @@
+// Internal policy header for TR1 unordered_set and unordered_map -*- C++ -*-
+
+// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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_policy.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. 
+ *  @headername{tr1/unordered_map, tr1/unordered_set}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{ 
+namespace tr1
+{
+namespace __detail
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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());
+    }
+
+  // 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;
+    };
+
+  template<typename _Value>
+    struct _Hash_node<_Value, false>
+    {
+      _Value       _M_v;
+      _Hash_node*  _M_next;
+    };
+
+  // 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 std::__addressof(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 std::__addressof(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 std::__addressof(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 std::__addressof(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 = std::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 = std::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 =
+	      std::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);
+    };
+
+  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;
+    }
+
+  // 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;
+    };
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __detail
+}
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hypergeometric.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hypergeometric.tcc
new file mode 100644
index 0000000..b98b5b2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hypergeometric.tcc
@@ -0,0 +1,779 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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 @a numerator parameter.
+     *   @param  __c  The @a 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 @a numerator parameter.
+     *   @param  __a  The second @a numerator parameter.
+     *   @param  __c  The @a 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 @a numerator parameter.
+     *   @param  __a  The second @a numerator parameter.
+     *   @param  __c  The @a 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);
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/inttypes.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/inttypes.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/legendre_function.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/legendre_function.tcc
new file mode 100644
index 0000000..db41d4e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/legendre_function.tcc
@@ -0,0 +1,306 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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;
+            }
+        }
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/limits.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/limits.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/math.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/math.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/memory b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/memory
new file mode 100644
index 0000000..eaf4932
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/memory
@@ -0,0 +1,53 @@
+// <tr1/memory> -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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>
+#include <tr1/shared_ptr.h>
+
+#endif // _GLIBCXX_TR1_MEMORY
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/modified_bessel_func.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/modified_bessel_func.tcc
new file mode 100644
index 0000000..ec134d5
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/modified_bessel_func.tcc
@@ -0,0 +1,437 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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;
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_hermite.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_hermite.tcc
new file mode 100644
index 0000000..95e8079
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_hermite.tcc
@@ -0,0 +1,125 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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);
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_POLY_HERMITE_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_laguerre.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_laguerre.tcc
new file mode 100644
index 0000000..769923d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_laguerre.tcc
@@ -0,0 +1,329 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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);
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_POLY_LAGUERRE_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random
new file mode 100644
index 0000000..5592647
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random
@@ -0,0 +1,50 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#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>
+#include <tr1/random.h>
+#include <tr1/random.tcc>
+
+#endif // _GLIBCXX_TR1_RANDOM
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.h
new file mode 100644
index 0000000..ace3792
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.h
@@ -0,0 +1,2417 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{tr1/random}
+ */
+
+#ifndef _GLIBCXX_TR1_RANDOM_H
+#define _GLIBCXX_TR1_RANDOM_H 1
+
+#pragma GCC system_header
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.1] Random number generation
+
+  /**
+   * @addtogroup tr1_random Random Number Generation
+   * A facility for generating random numbers on selected distributions.
+   * @{
+   */
+
+  /*
+   * Implementation-space details.
+   */
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    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;
+      };
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace __detail
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * 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;
+    };
+
+
+  /**
+   * @addtogroup 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 <em>the template parameter _IntType shall denote
+   * an integral type large enough to store values up to m</em>.
+   *
+   * @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
+
+  /**
+   * @addtogroup tr1_random_distributions Random Number Distributions
+   * @ingroup tr1_random
+   * @{
+   */
+
+  /**
+   * @addtogroup 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
+
+  /**
+   * @addtogroup 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_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_RANDOM_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.tcc
new file mode 100644
index 0000000..3d8c4fe
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.tcc
@@ -0,0 +1,1721 @@
+// random number generation (out of line) -*- C++ -*-
+
+// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.tcc
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{tr1/random}
+ */
+
+#ifndef _GLIBCXX_TR1_RANDOM_TCC
+#define _GLIBCXX_TR1_RANDOM_TCC 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  /*
+   * (Further) implementation-space details.
+   */
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    // 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; }
+      };
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace __detail
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    const _UIntType
+    linear_congruential<_UIntType, __a, __c, __m>::multiplier;
+
+  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    const _UIntType
+    linear_congruential<_UIntType, __a, __c, __m>::increment;
+
+  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+    const _UIntType
+    linear_congruential<_UIntType, __a, __c, __m>::modulus;
+
+  /**
+   * 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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::word_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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::shift_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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::mask_bits;
+
+  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>
+    const _UIntType
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::parameter_a;
+
+  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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::output_u;
+
+  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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::output_s;
+
+  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>
+    const _UIntType
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::output_b;
+
+  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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::output_t;
+
+  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>
+    const _UIntType
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::output_c;
+
+  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>
+    const int
+    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+		     __b, __t, __c, __l>::output_l;
+
+  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>
+    const _IntType
+    subtract_with_carry<_IntType, __m, __s, __r>::modulus;
+
+  template<typename _IntType, _IntType __m, int __s, int __r>
+    const int
+    subtract_with_carry<_IntType, __m, __s, __r>::long_lag;
+
+  template<typename _IntType, _IntType __m, int __s, int __r>
+    const int
+    subtract_with_carry<_IntType, __m, __s, __r>::short_lag;
+
+  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::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>
+    const int
+    subtract_with_carry_01<_RealType, __w, __s, __r>::word_size;
+
+  template<typename _RealType, int __w, int __s, int __r>
+    const int
+    subtract_with_carry_01<_RealType, __w, __s, __r>::long_lag;
+
+  template<typename _RealType, int __w, int __s, int __r>
+    const int
+    subtract_with_carry_01<_RealType, __w, __s, __r>::short_lag;
+
+  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::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::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>
+    const int
+    discard_block<_UniformRandomNumberGenerator, __p, __r>::block_size;
+
+  template<class _UniformRandomNumberGenerator, int __p, int __r>
+    const int
+    discard_block<_UniformRandomNumberGenerator, __p, __r>::used_block;
+
+  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>
+    const int
+    xor_combine<_UniformRandomNumberGenerator1, __s1,
+		_UniformRandomNumberGenerator2, __s2>::shift1;
+     
+  template<class _UniformRandomNumberGenerator1, int __s1,
+	   class _UniformRandomNumberGenerator2, int __s2>
+    const int
+    xor_combine<_UniformRandomNumberGenerator1, __s1,
+		_UniformRandomNumberGenerator2, __s2>::shift2;
+
+  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::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::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::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::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::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::tr1::lgamma(__np + 1)
+		   + std::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::tr1::lgamma(__np + __x + 1)
+		      + std::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_VERSION
+}
+}
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/regex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/regex
new file mode 100644
index 0000000..714a06d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/regex
@@ -0,0 +1,2730 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <algorithm>
+#include <bitset>
+#include <iterator>
+#include <locale>
+#include <stdexcept>
+#include <string>
+#include <vector>
+#include <utility>
+#include <sstream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+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
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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: 
+   * \\\\, \\a, \\b, \\f, 
+   * \\n, \\r, \\t , \\v, 
+   * \\&apos;, &apos;, 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 @a string that precedes the matched substring.
+   *         This would be match_results::prefix().
+   * @li $'  The portion of @a string 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 <em>*?+{</em> 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);
+
+  //@}
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // [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;
+      if (__radix == 8)
+	__is >> std::oct;
+      else if (__radix == 16)
+	__is >> std::hex;
+      __is >> __v;
+      return __is.fail() ? -1 : __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::tr1::sub_match<_Bi_iter>, _Allocator>
+    {
+    private:
+      typedef std::vector<std::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 @a 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_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_REGEX
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/riemann_zeta.tcc b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/riemann_zeta.tcc
new file mode 100644
index 0000000..18fe20e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/riemann_zeta.tcc
@@ -0,0 +1,436 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  // [5.2] Special functions
+
+  // Implementation-space details.
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /**
+     *   @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);
+    }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_RIEMANN_ZETA_TCC
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/shared_ptr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/shared_ptr.h
new file mode 100644
index 0000000..c42084c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/shared_ptr.h
@@ -0,0 +1,1179 @@
+// <tr1/shared_ptr.h> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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.
+ *  Do not attempt to use it directly. @headername{tr1/memory}
+ */
+
+#ifndef _TR1_SHARED_PTR_H
+#define _TR1_SHARED_PTR_H 1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ /**
+   *  @brief  Exception possibly thrown by @c shared_ptr.
+   *  @ingroup exceptions
+   */
+  class bad_weak_ptr : public std::exception
+  {
+  public:
+    virtual char const*
+    what() const throw()
+    { return "tr1::bad_weak_ptr"; }
+  };
+
+  // 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
+      {
+        // Be race-detector-friendly.  For more info see bits/c++config.
+        _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
+	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
+	  {
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
+	    _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;
+	      }
+
+            // Be race-detector-friendly.  For more info see bits/c++config.
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+	    if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
+						       -1) == 1)
+              {
+                _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+	        _M_destroy();
+              }
+	  }
+      }
+  
+      void
+      _M_weak_add_ref() // nothrow
+      { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
+
+      void
+      _M_weak_release() // nothrow
+      {
+        // Be race-detector-friendly. For more info see bits/c++config.
+        _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
+	if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
+	  {
+            _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
+	    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));
+    }
+
+  template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
+    class _Sp_counted_base_impl
+    : public _Sp_counted_base<_Lp>
+    {
+    public:
+      // Precondition: __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)
+      {
+#ifdef __GXX_RTTI
+        return __ti == typeid(_Deleter) ? &_M_del : 0;
+#else
+        return 0;
+#endif
+      }
+      
+    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 { };
+
+  // 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;
+      
+      __shared_ptr()
+      : _M_ptr(0), _M_refcount() // never throws
+      { }
+
+      template<typename _Tp1>
+        explicit
+        __shared_ptr(_Tp1* __p)
+	: _M_ptr(__p), _M_refcount(__p)
+        {
+	  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+	  typedef int _IsComplete[sizeof(_Tp1)];
+	  __enable_shared_from_this_helper(_M_refcount, __p, __p);
+	}
+
+      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.
+      
+      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*>) }
+
+      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_USE_DEPRECATED
+      // Postcondition: use_count() == 1 and __r.get() == 0
+      template<typename _Tp1>
+        explicit
+        __shared_ptr(std::auto_ptr<_Tp1>& __r)
+	: _M_ptr(__r.get()), _M_refcount()
+        { // TODO requries delete __r.release() well-formed
+	  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+	  typedef int _IsComplete[sizeof(_Tp1)];
+	  _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_USE_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
+  /*  The seemingly equivalent
+   *           shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))
+   *  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()); }
+
+  /*  The seemingly equivalent
+   *           shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))
+   *  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()); }
+
+  /*  The seemingly equivalent
+   *           shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))
+   *  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)
+    {
+#ifdef __GXX_RTTI
+      return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del)));
+#else
+      return 0;
+#endif
+    }
+
+
+  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;
+    };
+
+
+  // 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_USE_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_USE_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()); }
+
+
+  // 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
+      }
+    };
+
+  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;
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _TR1_SHARED_PTR_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/special_function_util.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/special_function_util.h
new file mode 100644
index 0000000..c90fc59
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/special_function_util.h
@@ -0,0 +1,144 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.
+ *  Do not attempt to use it directly. @headername{tr1/cmath}
+ */
+
+//
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+  namespace __detail
+  {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+    /// 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
+
+  _GLIBCXX_END_NAMESPACE_VERSION
+  } // namespace __detail
+}
+}
+
+#endif // _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdarg.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdarg.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdbool.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdbool.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdint.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdint.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdio.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdio.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdlib.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdlib.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tgmath.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tgmath.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tuple b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tuple
new file mode 100644
index 0000000..15ac642
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tuple
@@ -0,0 +1,426 @@
+// 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 _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_TUPLE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/type_traits b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/type_traits
new file mode 100644
index 0000000..2825fe6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/type_traits
@@ -0,0 +1,689 @@
+// TR1 type_traits -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <bits/c++config.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @defgroup metaprogramming Type Traits
+   * @ingroup utilities
+   *
+   * Compile time type transformation and information.
+   * @{
+   */
+
+  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
+  _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; };
+
+  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(0, __is_signed_helper, signed char, true)
+  _DEFINE_SPEC(0, __is_signed_helper, short, true)
+  _DEFINE_SPEC(0, __is_signed_helper, int, true)
+  _DEFINE_SPEC(0, __is_signed_helper, long, true)
+  _DEFINE_SPEC(0, __is_signed_helper, long long, true)
+
+  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(0, __is_unsigned_helper, unsigned char, true)
+  _DEFINE_SPEC(0, __is_unsigned_helper, unsigned short, true)
+  _DEFINE_SPEC(0, __is_unsigned_helper, unsigned int, true)
+  _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long, true)
+  _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long long, true)
+
+  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_0_HELPER
+#undef _DEFINE_SPEC_1_HELPER
+#undef _DEFINE_SPEC_2_HELPER
+#undef _DEFINE_SPEC
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_TYPE_TRAITS
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map
new file mode 100644
index 0000000..50bab9e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map
@@ -0,0 +1,44 @@
+// TR1 unordered_map -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#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>
+#include <tr1/unordered_map.h>
+
+#endif // _GLIBCXX_TR1_UNORDERED_MAP
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map.h
new file mode 100644
index 0000000..96404d3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map.h
@@ -0,0 +1,278 @@
+// TR1 unordered_map implementation -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{tr1/unordered_map}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // NB: 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)
+	{ }
+    };
+
+  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)
+	{ }
+    };
+
+  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)
+	{ }
+    };
+
+  /**
+   *  @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)
+	{ }
+
+    };
+
+  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); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set
new file mode 100644
index 0000000..3e2cbb0
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set
@@ -0,0 +1,44 @@
+// TR1 unordered_set -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#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>
+#include <tr1/unordered_set.h>
+
+#endif // _GLIBCXX_TR1_UNORDERED_SET
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set.h
new file mode 100644
index 0000000..e65a4cc
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set.h
@@ -0,0 +1,267 @@
+// TR1 unordered_set implementation -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{tr1/unordered_set}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // NB: 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)
+	{ }
+    };
+
+  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)
+	{ }
+    };
+
+  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)
+	{ }
+    };
+
+  /**
+   *  @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)
+	{ }
+    };
+
+  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); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+}
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/utility b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/utility
new file mode 100644
index 0000000..ef3673a
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/utility
@@ -0,0 +1,109 @@
+// TR1 utility -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008. 2009, 2010, 2011
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+
+#include <bits/c++config.h>
+#include <bits/stl_relops.h>
+#include <bits/stl_pair.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace tr1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<class _Tp>
+    class tuple_size;
+
+  template<int _Int, class _Tp>
+    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> >
+    { static const int value = 2; };
+
+  template<class _Tp1, class _Tp2>
+    const int
+    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; };
+
+  template<int _Int>
+    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; }
+    };
+
+  template<int _Int, class _Tp1, class _Tp2>
+    inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+    get(std::pair<_Tp1, _Tp2>& __in)
+    { return __pair_get<_Int>::__get(__in); }
+
+  template<int _Int, class _Tp1, class _Tp2>
+    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_VERSION
+}
+}
+
+#endif // _GLIBCXX_TR1_UTILITY
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wchar.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wchar.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wctype.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wctype.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tuple b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tuple
new file mode 100644
index 0000000..fb452ae
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/tuple
@@ -0,0 +1,808 @@
+// <tuple> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <utility>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // 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
+    {
+      constexpr _Head_base()
+      : _Head() { }
+
+      constexpr _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& __h)
+      {
+	using std::swap;
+	swap(__h, _M_head());
+      }
+    };
+
+  template<std::size_t _Idx, typename _Head>
+    struct _Head_base<_Idx, _Head, false>
+    {
+      constexpr _Head_base()
+      : _M_head_impl() { }
+
+      constexpr _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());
+      }
+
+      _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; }
+
+      constexpr _Tuple_impl()
+      : _Inherited(), _Base() { }
+
+      explicit 
+      constexpr _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)) { }
+
+      constexpr _Tuple_impl(const _Tuple_impl&) = default;
+
+      _Tuple_impl(_Tuple_impl&& __in)
+      : _Inherited(std::move(__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 _UHead, typename... _UTails>
+        _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
+	: _Inherited(std::move(__in._M_tail())),
+	  _Base(std::forward<_UHead>(__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::forward<_Head>(__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 _UHead, typename... _UTails>
+        _Tuple_impl&
+        operator=(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
+        {
+	  _M_head() = std::forward<_UHead>(__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:
+      constexpr tuple()
+      : _Inherited() { }
+
+      explicit
+      constexpr tuple(const _Elements&... __elements)
+      : _Inherited(__elements...) { }
+
+      template<typename... _UElements, typename = typename
+	       std::enable_if<sizeof...(_UElements)
+			      == sizeof...(_Elements)>::type>
+        explicit
+        tuple(_UElements&&... __elements)
+	: _Inherited(std::forward<_UElements>(__elements)...) {	}
+
+      constexpr tuple(const tuple&) = default;
+
+      tuple(tuple&& __in)
+      : _Inherited(static_cast<_Inherited&&>(__in)) { }
+
+      template<typename... _UElements, typename = typename
+	       std::enable_if<sizeof...(_UElements)
+			      == sizeof...(_Elements)>::type>
+        tuple(const tuple<_UElements...>& __in)
+        : _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
+        { }
+
+      template<typename... _UElements, typename = typename
+	       std::enable_if<sizeof...(_UElements)
+			      == sizeof...(_Elements)>::type>
+        tuple(tuple<_UElements...>&& __in)
+        : _Inherited(static_cast<_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, typename = typename
+	       std::enable_if<sizeof...(_UElements)
+			      == sizeof...(_Elements)>::type>
+        tuple&
+        operator=(const tuple<_UElements...>& __in)
+        {
+	  static_cast<_Inherited&>(*this) = __in;
+	  return *this;
+	}
+
+      template<typename... _UElements, typename = typename
+	       std::enable_if<sizeof...(_UElements)
+			      == sizeof...(_Elements)>::type>
+        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:
+      constexpr tuple()
+      : _Inherited() { }
+
+      explicit
+      constexpr 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)) { }
+
+      constexpr tuple(const tuple&) = default;
+
+      tuple(tuple&& __in)
+      : _Inherited(static_cast<_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(static_cast<_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::forward<_U1>(__in.first),
+		     std::forward<_U2>(__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::forward<_U1>(__in.first);
+	  this->_M_tail()._M_head() = std::forward<_U2>(__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());	
+      }
+    };
+
+  /// tuple (1-element).
+  template<typename _T1>
+    class tuple<_T1> : public _Tuple_impl<0, _T1>
+    {
+      typedef _Tuple_impl<0, _T1> _Inherited;
+
+    public:
+      constexpr tuple()
+      : _Inherited() { }
+
+      explicit
+      constexpr tuple(const _T1& __a1)
+      : _Inherited(__a1) { }
+
+      template<typename _U1, typename = typename
+	       std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
+        explicit
+        tuple(_U1&& __a1)
+	: _Inherited(std::forward<_U1>(__a1)) { }
+
+      constexpr tuple(const tuple&) = default;
+
+      tuple(tuple&& __in)
+      : _Inherited(static_cast<_Inherited&&>(__in)) { }
+
+      template<typename _U1>
+        tuple(const tuple<_U1>& __in)
+	: _Inherited(static_cast<const _Tuple_impl<0, _U1>&>(__in)) { }
+
+      template<typename _U1>
+        tuple(tuple<_U1>&& __in)
+	: _Inherited(static_cast<_Tuple_impl<0, _U1>&&>(__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 _U1>
+        tuple&
+        operator=(const tuple<_U1>& __in)
+        {
+	  static_cast<_Inherited&>(*this) = __in;
+	  return *this;
+	}
+
+      template<typename _U1>
+        tuple&
+        operator=(tuple<_U1>&& __in)
+        {
+	  static_cast<_Inherited&>(*this) = std::move(__in);
+	  return *this;
+	}
+
+      void
+      swap(tuple& __in)
+      { _Inherited::_M_swap_impl(__in); }
+    };
+
+
+  /// 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<typename... _Elements>
+    inline tuple<_Elements&&...>
+    forward_as_tuple(_Elements&&... __args)
+    { return tuple<_Elements&&...>(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::forward<_TElements>(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::forward<_UElements>(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::forward<_TElements>(get<_TIdx>(__t))...,
+	 std::forward<_UElements>(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); }
+
+  // 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>
+      const _Swallow_assign&
+      operator=(const _Tp&) const
+      { return *this; }
+  };
+
+  const _Swallow_assign ignore{};
+
+  /**
+   * Stores a tuple of indices. Used by bind() to extract the elements
+   * in a tuple. 
+   */
+  template<int... _Indexes>
+    struct _Index_tuple
+    {
+      typedef _Index_tuple<_Indexes..., sizeof...(_Indexes)> __next;
+    };
+
+  /// Builds an _Index_tuple<0, 1, 2, ..., _Num-1>.
+  template<std::size_t _Num>
+    struct _Build_index_tuple
+    {
+      typedef typename _Build_index_tuple<_Num-1>::__type::__next __type;
+    };
+
+  template<>
+    struct _Build_index_tuple<0>
+    {
+      typedef _Index_tuple<> __type;
+    };
+
+  // See stl_pair.h...
+  template<class _T1, class _T2>
+    template<typename _Tp, typename... _Args>
+      inline _Tp
+      pair<_T1, _T2>::
+      __cons(tuple<_Args...>&& __tuple)
+      {
+	typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
+	  _Indexes;
+	return __do_cons<_Tp>(std::move(__tuple), _Indexes());
+      }
+
+  template<class _T1, class _T2>
+    template<typename _Tp, typename... _Args, int... _Indexes>
+      inline _Tp
+      pair<_T1, _T2>::
+      __do_cons(tuple<_Args...>&& __tuple,
+		const _Index_tuple<_Indexes...>&)
+      { return _Tp(std::forward<_Args>(get<_Indexes>(__tuple))...); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_TUPLE
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/type_traits b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/type_traits
new file mode 100644
index 0000000..2361152
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/type_traits
@@ -0,0 +1,1271 @@
+// C++0x type_traits -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @addtogroup metaprogramming
+   * @{
+   */
+  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.
+
+  /// integral_constant
+  template<typename _Tp, _Tp __v>
+    struct integral_constant
+    {
+      static constexpr _Tp                  value = __v;
+      typedef _Tp                           value_type;
+      typedef integral_constant<_Tp, __v>   type;
+      constexpr operator value_type() { return value; }
+    };
+  
+  /// 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>
+    constexpr _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.
+
+  /// 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
+  _DEFINE_SPEC(0, __is_integral_helper, char16_t, true)
+  _DEFINE_SPEC(0, __is_integral_helper, char32_t, true)
+  _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 { };
+
+  template<typename>
+    struct __is_nullptr_t_helper
+    : public false_type { };
+  _DEFINE_SPEC(0, __is_nullptr_t_helper, std::nullptr_t, true)
+
+  // __is_nullptr_t (extension).
+  template<typename _Tp>
+    struct __is_nullptr_t
+    : public integral_constant<bool, (__is_nullptr_t_helper<typename
+				      remove_cv<_Tp>::type>::value)>
+    { };
+
+  // composite type traits.
+  
+  /// 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_nullptr_t<_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.
+  /// 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.
+
+  /// 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.
+
+  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; };
+
+  // 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, static_cast<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_trivial
+  template<typename _Tp>
+    struct is_trivial
+    : public integral_constant<bool, __is_trivial(_Tp)>
+    { };
+
+  /// is_standard_layout
+  template<typename _Tp>
+    struct is_standard_layout
+    : public integral_constant<bool, __is_standard_layout(_Tp)>
+    { };
+
+  /// is_pod
+  // Could use is_standard_layout && is_trivial instead of the builtin.
+  template<typename _Tp>
+    struct is_pod
+    : public integral_constant<bool, __is_pod(_Tp)>
+    { };
+
+  /// is_literal_type
+  template<typename _Tp>
+    struct is_literal_type
+    : public integral_constant<bool, __is_literal_type(_Tp)>
+    { };
+
+  template<typename _Tp>
+    typename add_rvalue_reference<_Tp>::type declval() noexcept;
+
+  template<typename _Tp, typename... _Args>
+    class __is_constructible_helper
+    : public __sfinae_types
+    {
+      template<typename _Tp1, typename... _Args1>
+        static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int);
+
+      template<typename, typename...>
+        static __two __test(...);
+
+    public:
+      static const bool __value = sizeof(__test<_Tp, _Args...>(0)) == 1;
+    };
+
+  template<typename _Tp, typename _Arg>
+    class __is_constructible_helper<_Tp, _Arg>
+    : public __sfinae_types
+    {
+      template<typename _Tp1, typename _Arg1>
+        static decltype(static_cast<_Tp1>(declval<_Arg1>()), __one())
+	__test(int);
+
+      template<typename, typename>
+        static __two __test(...);
+
+    public:
+      static const bool __value = sizeof(__test<_Tp, _Arg>(0)) == 1;
+    };
+
+  /// is_constructible
+  // XXX FIXME
+  // The C++0x specifications require front-end support, see N2255.
+  template<typename _Tp, typename... _Args>
+    struct is_constructible
+    : public integral_constant<bool,
+			       __is_constructible_helper<_Tp,
+							 _Args...>::__value>
+    { };
+
+  template<bool, typename _Tp, typename... _Args>
+    struct __is_nt_constructible_helper
+    { static const bool __value = false; };
+
+  template<typename _Tp, typename... _Args>
+    struct __is_nt_constructible_helper<true, _Tp, _Args...>
+    { static const bool __value = noexcept(_Tp(declval<_Args>()...)); };
+
+  template<typename _Tp, typename _Arg>
+    struct __is_nt_constructible_helper<true, _Tp, _Arg>
+    {
+      static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));
+    };
+
+  /// is_nothrow_constructible
+  template<typename _Tp, typename... _Args>
+    struct is_nothrow_constructible
+    : public integral_constant<bool,
+	  __is_nt_constructible_helper<is_constructible<_Tp, _Args...>::value,
+				       _Tp, _Args...>::__value>
+    { };
+
+  /// 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_copy_assign
+  template<typename _Tp>
+    struct has_trivial_copy_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_copy_assign
+  template<typename _Tp>
+    struct has_nothrow_copy_assign
+    : public integral_constant<bool, __has_nothrow_assign(_Tp)>
+    { };
+
+  // Relationships between types.
+
+  /// is_base_of
+  template<typename _Base, typename _Derived>
+    struct is_base_of
+    : public integral_constant<bool, __is_base_of(_Base, _Derived)>
+    { };
+
+  template<typename _From, typename _To,
+	   bool = (is_void<_From>::value || is_function<_To>::value
+		   || is_array<_To>::value)>
+    struct __is_convertible_helper
+    { static const bool __value = is_void<_To>::value; };
+
+  template<typename _From, typename _To>
+    class __is_convertible_helper<_From, _To, false>
+    : public __sfinae_types
+    {
+      template<typename _To1>
+        static void __test_aux(_To1);
+
+      template<typename _From1, typename _To1>
+        static decltype(__test_aux<_To1>(std::declval<_From1>()), __one())
+	__test(int);
+
+      template<typename, typename>
+        static __two __test(...);
+
+    public:
+      static const bool __value = sizeof(__test<_From, _To>(0)) == 1;
+    };
+
+  /// is_convertible
+  // XXX FIXME
+  // The C++0x specifications require front-end support, see N2255.
+  template<typename _From, typename _To>
+    struct is_convertible
+    : public integral_constant<bool,
+			       __is_convertible_helper<_From, _To>::__value>
+    { };
+
+  /// is_explicitly_convertible
+  template<typename _From, typename _To>
+    struct is_explicitly_convertible
+    : public is_constructible<_To, _From>
+    { };
+
+  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> 
+    class decay 
+    { 
+      typedef typename remove_reference<_Tp>::type __remove_type;
+
+    public:
+      typedef typename __decay_selector<__remove_type>::__type type;
+    };
+
+  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;
+    };
+
+
+  // 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>
+    class __match_cv_qualifiers
+    {
+      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>
+    class __make_unsigned_selector;
+
+  template<typename _Tp>
+    class __make_unsigned_selector<_Tp, true, false>
+    {
+      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>
+    class __make_unsigned_selector<_Tp, false, true>
+    {
+      // 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>
+    class __make_signed_selector;
+
+  template<typename _Tp>
+    class __make_signed_selector<_Tp, true, false>
+    {
+      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>
+    class __make_signed_selector<_Tp, false, true>
+    {
+      // 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>
+    { typedef _Tp type; };
+
+  template<typename _Tp, typename _Up>
+    struct common_type<_Tp, _Up>
+    { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) 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;
+    };
+
+  /// declval
+  template<typename _Tp>
+    struct __declval_protector
+    {
+      static const bool __stop = false;
+      static typename add_rvalue_reference<_Tp>::type __delegate();
+    };
+
+  template<typename _Tp>
+    inline typename add_rvalue_reference<_Tp>::type
+    declval() noexcept
+    {
+      static_assert(__declval_protector<_Tp>::__stop,
+		    "declval() must not be used!");
+      return __declval_protector<_Tp>::__delegate();
+    }
+
+  /// result_of
+  template<typename _Signature>
+    class result_of;
+
+  template<typename _MemPtr, typename _Arg>
+    struct _Result_of_memobj;
+
+  template<typename _Res, typename _Class, typename _Arg>
+    struct _Result_of_memobj<_Res _Class::*, _Arg>
+    {
+    private:
+      typedef _Res _Class::* _Func;
+
+      template<typename _Tp>
+	static _Tp _S_get(const _Class&);
+      template<typename _Tp>
+	static decltype(*std::declval<_Tp>()) _S_get(...);
+        
+    public:
+      typedef
+        decltype(_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
+        __type;
+    };
+
+  template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
+    struct _Result_of_memfun;
+
+  template<typename _Res, typename _Class, typename _Arg, typename... _Args>
+    struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...>
+    {
+    private:
+      typedef _Res _Class::* _Func;
+
+      template<typename _Tp>
+	static _Tp _S_get(const _Class&);
+      template<typename _Tp>
+	static decltype(*std::declval<_Tp>()) _S_get(...);
+        
+    public:
+      typedef
+        decltype((_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
+            (std::declval<_Args>()...) )
+        __type;
+    };
+
+  template<bool, bool, typename _Functor, typename... _ArgTypes>
+    struct _Result_of_impl;
+
+  template<typename _Functor, typename... _ArgTypes>
+    struct _Result_of_impl<false, false, _Functor, _ArgTypes...>
+    {
+      typedef
+        decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) )
+        __type;
+    };
+
+  template<typename _MemPtr, typename _Arg>
+    struct _Result_of_impl<true, false, _MemPtr, _Arg>
+    : _Result_of_memobj<typename remove_reference<_MemPtr>::type, _Arg>
+    {
+      typedef typename _Result_of_memobj<
+	typename remove_reference<_MemPtr>::type, _Arg>::__type
+	__type;
+    };
+
+  template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
+    struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...>
+    : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg,
+                        _ArgTypes...>
+    {
+      typedef typename _Result_of_memfun<
+	typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type
+	__type;
+    };
+
+  template<typename _Functor, typename... _ArgTypes>
+    struct result_of<_Functor(_ArgTypes...)>
+    : _Result_of_impl<is_member_object_pointer<
+                        typename remove_reference<_Functor>::type >::value,
+                      is_member_function_pointer<
+			typename remove_reference<_Functor>::type >::value,
+		      _Functor, _ArgTypes...>
+    {
+      typedef typename _Result_of_impl<
+	is_member_object_pointer<
+	  typename remove_reference<_Functor>::type >::value,
+        is_member_function_pointer<
+	  typename remove_reference<_Functor>::type >::value,
+       	_Functor, _ArgTypes...>::__type
+	type;
+    };
+
+  /**
+   *  Use SFINAE to determine if the type _Tp has a publicly-accessible
+   *  member type _NTYPE.
+   */
+#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE)                         \
+  template<typename _Tp>                                         \
+    class __has_##_NTYPE##_helper                                \
+    : __sfinae_types                                             \
+    {                                                            \
+      template<typename _Up>                                     \
+        struct _Wrap_type                                        \
+	{ };                                                     \
+                                                                 \
+      template<typename _Up>                                     \
+        static __one __test(_Wrap_type<typename _Up::_NTYPE>*);  \
+                                                                 \
+      template<typename _Up>                                     \
+        static __two __test(...);                                \
+                                                                 \
+    public:                                                      \
+      static const bool value = sizeof(__test<_Tp>(0)) == 1;     \
+    };                                                           \
+                                                                 \
+  template<typename _Tp>                                         \
+    struct __has_##_NTYPE                                        \
+    : integral_constant<bool, __has_##_NTYPE##_helper            \
+			<typename remove_cv<_Tp>::type>::value>  \
+    { };
+
+#undef _DEFINE_SPEC_0_HELPER
+#undef _DEFINE_SPEC_1_HELPER
+#undef _DEFINE_SPEC_2_HELPER
+#undef _DEFINE_SPEC
+
+  // @} group metaprogramming
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif  // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif  // _GLIBCXX_TYPE_TRAITS
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeindex b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeindex
new file mode 100644
index 0000000..78aeeb1
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeindex
@@ -0,0 +1,109 @@
+// C++0x typeindex -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/typeindex
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TYPEINDEX
+#define _GLIBCXX_TYPEINDEX 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+
+#include <typeinfo>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+     @brief The class type_index provides a simple wrapper for type_info
+     which can be used as an index type in associative containers (23.6)
+     and in unordered associative containers (23.7).
+   */
+  struct type_index
+  {
+    type_index(const type_info& __rhs)
+    : _M_target(&__rhs) { }
+
+    bool
+    operator==(const type_index& __rhs) const
+    { return *_M_target == *__rhs._M_target; }
+
+    bool
+    operator!=(const type_index& __rhs) const
+    { return *_M_target != *__rhs._M_target; }
+
+    bool
+    operator<(const type_index& __rhs) const
+    { return _M_target->before(*__rhs._M_target); }
+
+    bool
+    operator<=(const type_index& __rhs) const
+    { return !__rhs._M_target->before(*_M_target); }
+
+    bool
+    operator>(const type_index& __rhs) const
+    { return __rhs._M_target->before(*_M_target); }
+
+    bool
+    operator>=(const type_index& __rhs) const
+    { return !_M_target->before(*__rhs._M_target); }
+
+    size_t
+    hash_code() const noexcept
+    { return _M_target->hash_code(); }
+
+    const char*
+    name() const
+    { return _M_target->name(); }
+
+  private:
+    const type_info* _M_target;
+  };
+
+  template<typename _Tp> struct hash;
+
+  /// std::hash specialization for type_index.
+  template<>
+    struct hash<type_index>
+    {
+      typedef size_t        result_type;
+      typedef type_index  argument_type;
+
+      size_t
+      operator()(const type_index& __ti) const noexcept
+      { return __ti.hash_code(); }
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif  // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif  // _GLIBCXX_TYPEINDEX
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeinfo b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeinfo
new file mode 100644
index 0000000..22ef49f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeinfo
@@ -0,0 +1,224 @@
+// RTTI support for -*- C++ -*-
+// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+// 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3, or (at your option)
+// any later version.
+// 
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file typeinfo
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _TYPEINFO
+#define _TYPEINFO
+
+#pragma GCC system_header
+
+#include <exception>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/hash_bytes.h>
+#endif
+
+
+#pragma GCC visibility push(default)
+
+extern "C++" {
+
+namespace __cxxabiv1
+{
+  class __class_type_info;
+} // namespace __cxxabiv1
+
+// Determine whether typeinfo names for the same type are merged (in which
+// case comparison can just compare pointers) or not (in which case strings
+// must be compared), and whether comparison is to be implemented inline or
+// not.  We used to do inline pointer comparison by default if weak symbols
+// are available, but even with weak symbols sometimes names are not merged
+// when objects are loaded with RTLD_LOCAL, so now we always use strcmp by
+// default.  For ABI compatibility, we do the strcmp inline if weak symbols
+// are available, and out-of-line if not.  Out-of-line pointer comparison
+// is used where the object files are to be portable to multiple systems,
+// some of which may not be able to use pointer comparison, but the
+// particular system for which libstdc++ is being built can use pointer
+// comparison; in particular for most ARM EABI systems, where the ABI
+// specifies out-of-line comparison.  The compiler's target configuration
+// can override the defaults by defining __GXX_TYPEINFO_EQUALITY_INLINE to
+// 1 or 0 to indicate whether or not comparison is inline, and
+// __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to indicate whether or not pointer
+// comparison can be used.
+
+#ifndef __GXX_MERGED_TYPEINFO_NAMES
+// By default, typeinfo names are not merged.
+#define __GXX_MERGED_TYPEINFO_NAMES 0
+#endif
+
+// By default follow the old inline rules to avoid ABI changes.
+#ifndef __GXX_TYPEINFO_EQUALITY_INLINE
+  #if !__GXX_WEAK__
+    #define __GXX_TYPEINFO_EQUALITY_INLINE 0
+  #else
+    #define __GXX_TYPEINFO_EQUALITY_INLINE 1
+  #endif
+#endif
+
+namespace std 
+{
+  /**
+   *  @brief  Part of RTTI.
+   *
+   *  The @c type_info class describes type information generated by
+   *  an implementation.
+  */
+  class type_info 
+  {
+  public:
+    /** Destructor first. Being the first non-inline virtual function, this
+     *  controls in which translation unit the vtable is emitted. The
+     *  compiler makes use of that information to know where to emit
+     *  the runtime-mandated type_info structures in the new-abi.  */
+    virtual ~type_info();
+
+    /** Returns an @e implementation-defined byte string; this is not
+     *  portable between compilers!  */
+    const char* name() const
+    { return __name[0] == '*' ? __name + 1 : __name; }
+
+#if !__GXX_TYPEINFO_EQUALITY_INLINE
+    // In old abi, or when weak symbols are not supported, there can
+    // be multiple instances of a type_info object for one
+    // type. Uniqueness must use the _name value, not object address.
+    bool before(const type_info& __arg) const;
+    bool operator==(const type_info& __arg) const;
+#else
+  #if !__GXX_MERGED_TYPEINFO_NAMES
+    /** Returns true if @c *this precedes @c __arg in the implementation's
+     *  collation order.  */
+    // Even with the new abi, on systems that support dlopen
+    // we can run into cases where type_info names aren't merged,
+    // so we still need to do string comparison.
+    bool before(const type_info& __arg) const
+    { return (__name[0] == '*' && __arg.__name[0] == '*')
+	? __name < __arg.__name
+	: __builtin_strcmp (__name, __arg.__name) < 0; }
+
+    bool operator==(const type_info& __arg) const
+    {
+      return ((__name == __arg.__name)
+	      || (__name[0] != '*' &&
+		  __builtin_strcmp (__name, __arg.__name) == 0));
+    }
+  #else
+    // On some targets we can rely on type_info's NTBS being unique,
+    // and therefore address comparisons are sufficient.
+    bool before(const type_info& __arg) const
+    { return __name < __arg.__name; }
+
+    bool operator==(const type_info& __arg) const
+    { return __name == __arg.__name; }
+  #endif
+#endif
+    bool operator!=(const type_info& __arg) const
+    { return !operator==(__arg); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    size_t hash_code() const noexcept
+    {
+#  if !__GXX_MERGED_TYPEINFO_NAMES
+      return _Hash_bytes(name(), __builtin_strlen(name()),
+			 static_cast<size_t>(0xc70f6907UL));
+#  else
+      return reinterpret_cast<size_t>(__name);
+#  endif
+    }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+    // Return true if this is a pointer type of some kind
+    virtual bool __is_pointer_p() const;
+
+    // Return true if this is a function type
+    virtual bool __is_function_p() const;
+
+    // Try and catch a thrown type. Store an adjusted pointer to the
+    // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
+    // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
+    // type, then THR_OBJ is the pointer itself. OUTER indicates the
+    // number of outer pointers, and whether they were const
+    // qualified.
+    virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj,
+			    unsigned __outer) const;
+
+    // Internally used during catch matching
+    virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
+			     void **__obj_ptr) const;
+
+  protected:
+    const char *__name;
+    
+    explicit type_info(const char *__n): __name(__n) { }
+    
+  private:
+    /// Assigning type_info is not supported.
+    type_info& operator=(const type_info&);
+    type_info(const type_info&);
+  };
+
+  /**
+   *  @brief  Thrown during incorrect typecasting.
+   *  @ingroup exceptions
+   *
+   *  If you attempt an invalid @c dynamic_cast expression, an instance of
+   *  this class (or something derived from this class) is thrown.  */
+  class bad_cast : public exception 
+  {
+  public:
+    bad_cast() throw() { }
+
+    // This declaration is not useless:
+    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
+    virtual ~bad_cast() throw();
+
+    // See comment in eh_exception.cc.
+    virtual const char* what() const throw();
+  };
+  
+  /** 
+   *  @brief Thrown when a NULL pointer in a @c typeid expression is used.
+   *  @ingroup exceptions
+   */
+  class bad_typeid : public exception 
+  {
+  public:
+    bad_typeid () throw() { }
+
+    // This declaration is not useless:
+    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
+    virtual ~bad_typeid() throw();
+
+    // See comment in eh_exception.cc.
+    virtual const char* what() const throw();
+  };
+} // namespace std
+
+#pragma GCC visibility pop
+
+} // extern "C++"
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_map b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_map
new file mode 100644
index 0000000..e77a297
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_map
@@ -0,0 +1,59 @@
+// <unordered_map> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#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/functional_hash.h>
+#include <bits/hashtable.h>
+#include <bits/unordered_map.h>
+#include <bits/range_access.h>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/unordered_map>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/unordered_map>
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_UNORDERED_MAP
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_set b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_set
new file mode 100644
index 0000000..739e0a4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_set
@@ -0,0 +1,58 @@
+// <unordered_set> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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 <bits/c++0x_warning.h>
+#else
+
+#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/functional_hash.h>
+#include <bits/hashtable.h>
+#include <bits/unordered_set.h>
+#include <bits/range_access.h>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/unordered_set>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/unordered_set>
+#endif
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_UNORDERED_SET
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/utility b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/utility
new file mode 100644
index 0000000..245c41f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/utility
@@ -0,0 +1,146 @@
+// <utility> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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
+
+/**
+ * @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.
+ */
+
+#include <bits/c++config.h>
+#include <bits/stl_relops.h>
+#include <bits/stl_pair.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/move.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<class _Tp>
+    class tuple_size;
+
+  template<std::size_t _Int, class _Tp>
+    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> >
+    { static const std::size_t value = 2; };
+
+  template<class _Tp1, class _Tp2>
+    const std::size_t
+    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; };
+
+  template<std::size_t _Int>
+    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; }
+    };
+
+  template<std::size_t _Int, class _Tp1, class _Tp2>
+    inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+    get(std::pair<_Tp1, _Tp2>& __in)
+    { return __pair_get<_Int>::__get(__in); }
+
+  template<std::size_t _Int, class _Tp1, class _Tp2>
+    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_VERSION
+} // namespace
+
+#endif
+
+#endif /* _GLIBCXX_UTILITY */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/valarray b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/valarray
new file mode 100644
index 0000000..9c18e05
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/valarray
@@ -0,0 +1,1165 @@
+// The template and inlines for the -*- C++ -*- valarray class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/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 <cmath>
+#include <algorithm>
+#include <debug/debug.h>
+#include <initializer_list>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  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_VERSION
+} // namespace
+
+#include <bits/valarray_array.h>
+#include <bits/valarray_before.h>
+  
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_VERSION
+} // 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>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /**
+   * @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_RESOLVE_LIB_DEFECTS
+      // 630. arrays of valarray.
+      if (_M_size == __v._M_size)
+	std::__valarray_copy(__v._M_data, _M_size, _M_data);
+      else
+	{
+	  if (_M_data)
+	    {
+	      std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
+	      std::__valarray_release_memory(_M_data);
+	    }
+	  _M_size = __v._M_size;
+	  _M_data = __valarray_get_storage<_Tp>(_M_size);
+	  std::__valarray_copy_construct(__v._M_data, __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_RESOLVE_LIB_DEFECTS
+      // 630. arrays of valarray.
+      if (_M_size == __l.size())
+	std::__valarray_copy(__l.begin(), __l.size(), _M_data);
+      else
+	{
+	  if (_M_data)
+	    {
+	      std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
+	      std::__valarray_release_memory(_M_data);
+	    }
+	  _M_size = __l.size();
+	  _M_data = __valarray_get_storage<_Tp>(_M_size);
+	  std::__valarray_copy_construct(__l.begin(), __l.begin() + _M_size,
+					 _M_data);
+	}
+      return *this;
+    }
+#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
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline _Tp*
+    begin(valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]); }
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the const valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline const _Tp*
+    begin(const valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline _Tp*
+    end(valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]) + __va.size(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the const valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline const _Tp*
+    end(const valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]) + __va.size(); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+  // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif /* _GLIBCXX_VALARRAY */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/include/vector b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/vector
new file mode 100644
index 0000000..5ea82d8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/include/vector
@@ -0,0 +1,82 @@
+// <vector> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime 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
+ ded "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> 
+#include <bits/range_access.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/vector.tcc>
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/vector>
+#endif
+
+#ifdef _GLIBCXX_PROFILE
+# include <profile/vector>
+#endif
+
+#endif /* _GLIBCXX_VECTOR */
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/atomic_word.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/basic_file.h
@@ -0,0 +1,111 @@
+// Wrapper of C-language FILE struct -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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  File-based streams
+//
+
+/** @file bits/basic_file.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
+#define _GLIBCXX_BASIC_FILE_STDIO_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/c++io.h>  // for __c_lock and __c_file
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Generic declaration.
+  template<typename _CharT>
+    class __basic_file; 
+
+  // Specialization.
+  template<>
+    class __basic_file<char>
+    {
+      // Underlying data source/sink.
+      __c_file* 	_M_cfile;
+
+      // True iff we opened _M_cfile, and thus must close it ourselves.
+      bool 		_M_cfile_created;
+
+    public:
+      __basic_file(__c_lock* __lock = 0) throw ();
+
+      __basic_file* 
+      open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
+
+      __basic_file*
+      sys_open(__c_file* __file, ios_base::openmode);
+
+      __basic_file*
+      sys_open(int __fd, ios_base::openmode __mode) throw ();
+
+      __basic_file* 
+      close(); 
+
+      _GLIBCXX_PURE bool 
+      is_open() const throw ();
+
+      _GLIBCXX_PURE int 
+      fd() throw ();
+
+      _GLIBCXX_PURE __c_file*
+      file() throw ();
+
+      ~__basic_file();
+
+      streamsize 
+      xsputn(const char* __s, streamsize __n);
+
+      streamsize 
+      xsputn_2(const char* __s1, streamsize __n1,
+	       const char* __s2, streamsize __n2);
+
+      streamsize 
+      xsgetn(char* __s, streamsize __n);
+
+      streamoff
+      seekoff(streamoff __off, ios_base::seekdir __way) throw ();
+
+      int 
+      sync();
+
+      streamsize
+      showmanyc();
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif	
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++allocator.h
@@ -0,0 +1,37 @@
+// Base to std::allocator -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++allocator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _GLIBCXX_CXX_ALLOCATOR_H
+#define _GLIBCXX_CXX_ALLOCATOR_H 1
+
+// Define new_allocator as the base class to std::allocator.
+#include <ext/new_allocator.h>
+#define __glibcxx_base_allocator  __gnu_cxx::new_allocator
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++config.h
new file mode 100644
index 0000000..2f0c5c6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++config.h
@@ -0,0 +1,1569 @@
+// Predefined symbols and macros -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++config.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#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__ 20120106
+
+// Macros for various attributes.
+//   _GLIBCXX_PURE
+//   _GLIBCXX_CONST
+//   _GLIBCXX_NORETURN
+//   _GLIBCXX_NOTHROW
+//   _GLIBCXX_VISIBILITY
+#ifndef _GLIBCXX_PURE
+# define _GLIBCXX_PURE __attribute__ ((__pure__))
+#endif
+
+#ifndef _GLIBCXX_CONST
+# define _GLIBCXX_CONST __attribute__ ((__const__))
+#endif
+
+#ifndef _GLIBCXX_NORETURN
+# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+#ifndef _GLIBCXX_NOTHROW
+# ifdef __cplusplus
+#  define _GLIBCXX_NOTHROW throw()
+# else
+#  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
+# endif
+#endif
+
+// Macros for visibility attributes.
+//   _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+//   _GLIBCXX_VISIBILITY
+# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
+
+#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
+#else
+// If this is not supplied by the OS-specific or CPU-specific
+// headers included below, it will be defined to an empty default.
+# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
+#endif
+
+// Macros for deprecated attributes.
+//   _GLIBCXX_USE_DEPRECATED
+//   _GLIBCXX_DEPRECATED
+#ifndef _GLIBCXX_USE_DEPRECATED
+# define _GLIBCXX_USE_DEPRECATED 1
+#endif
+
+#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
+#else
+# define _GLIBCXX_DEPRECATED
+#endif
+
+#if __cplusplus
+
+// Macro for constexpr, to support in mixed 03/0x mode.
+#ifndef _GLIBCXX_CONSTEXPR
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+#  define _GLIBCXX_CONSTEXPR constexpr
+#  define _GLIBCXX_USE_CONSTEXPR constexpr
+# else
+#  define _GLIBCXX_CONSTEXPR
+#  define _GLIBCXX_USE_CONSTEXPR const
+# endif
+#endif
+
+// Macro for extern template, ie controling template linkage via use
+// of extern keyword on template declaration. As documented in the g++
+// manual, 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.
+// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
+// templates only in basic_string, thus activating its debug-mode
+// checks even at -O0.
+# define _GLIBCXX_EXTERN_TEMPLATE 1
+
+/*
+  Outline of libstdc++ namespaces.
+
+  namespace std
+  {
+    namespace __debug { }
+    namespace __parallel { }
+    namespace __profile { }
+    namespace __cxx1998 { }
+
+    namespace __detail { }
+
+    namespace rel_ops { }
+
+    namespace tr1
+    {
+      namespace placeholders { }
+      namespace regex_constants { }
+      namespace __detail { }
+    }
+
+    namespace decimal { }
+
+    namespace chrono { }
+    namespace placeholders { }
+    namespace regex_constants { }
+    namespace this_thread { }
+  }
+
+  namespace abi { }
+
+  namespace __gnu_cxx
+  {
+    namespace __detail { }
+  }
+
+  For full details see:
+  http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
+*/
+namespace std
+{
+  typedef __SIZE_TYPE__ 	size_t;
+  typedef __PTRDIFF_TYPE__	ptrdiff_t;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  typedef decltype(nullptr)	nullptr_t;
+#endif
+}
+
+
+// Defined if inline namespaces are used for versioning.
+# define _GLIBCXX_INLINE_VERSION 0 
+
+// Inline namespace for symbol versioning.
+#if _GLIBCXX_INLINE_VERSION
+
+namespace std
+{
+  inline namespace __7 { }
+
+  namespace rel_ops { inline namespace __7 { } }
+
+  namespace tr1
+  {
+    inline namespace __7 { }
+    namespace placeholders { inline namespace __7 { } }
+    namespace regex_constants { inline namespace __7 { } }
+    namespace __detail { inline namespace __7 { } }
+  }
+
+  namespace decimal { inline namespace __7 { } }
+
+  namespace chrono { inline namespace __7 { } }
+  namespace placeholders { inline namespace __7 { } }
+  namespace regex_constants { inline namespace __7 { } }
+  namespace this_thread { inline namespace __7 { } }
+
+  namespace __detail { inline namespace __7 { } }
+  namespace __regex { inline namespace __7 { } }
+}
+
+namespace __gnu_cxx
+{
+  inline namespace __7 { }
+  namespace __detail { inline namespace __7 { } }
+}
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 {
+# define _GLIBCXX_END_NAMESPACE_VERSION }
+#else
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+
+// Inline namespaces for special modes: debug, parallel, profile.
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
+    || defined(_GLIBCXX_PROFILE)
+namespace std
+{
+  // Non-inline namespace for components replaced by alternates in active mode.
+  namespace __cxx1998
+  {
+#if _GLIBCXX_INLINE_VERSION
+ inline namespace __7 { }
+#endif
+  }
+
+  // Inline namespace for debug mode.
+# ifdef _GLIBCXX_DEBUG
+  inline namespace __debug { }
+# endif
+
+  // Inline namespaces for parallel mode.
+# ifdef _GLIBCXX_PARALLEL
+  inline namespace __parallel { }
+# endif
+
+  // Inline namespaces for profile mode
+# ifdef _GLIBCXX_PROFILE
+  inline namespace __profile { }
+# endif
+}
+
+// Check for invalid usage and unsupported mixed-mode use.
+# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+
+// Check for invalid use due to lack for weak symbols.
+# if __NO_INLINE__ && !__GXX_WEAK__
+#  warning currently using inlined namespace mode which may fail \
+   without inlining due to lack of weak symbols
+# endif
+#endif
+
+// Macros for namespace scope. Either namespace std:: or the name
+// of some nested namespace within it corresponding to the active mode.
+// _GLIBCXX_STD_A
+// _GLIBCXX_STD_C
+//
+// Macros for opening/closing conditional namespaces.
+// _GLIBCXX_BEGIN_NAMESPACE_ALGO
+// _GLIBCXX_END_NAMESPACE_ALGO
+// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+// _GLIBCXX_END_NAMESPACE_CONTAINER
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
+# define _GLIBCXX_STD_C __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
+	 namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_CONTAINER \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+# undef _GLIBCXX_EXTERN_TEMPLATE
+#  define _GLIBCXX_EXTERN_TEMPLATE 1 -1
+#endif
+
+#ifdef _GLIBCXX_PARALLEL
+# define _GLIBCXX_STD_A __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
+	 namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_ALGO \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+#ifndef _GLIBCXX_STD_A
+# define _GLIBCXX_STD_A std
+#endif
+
+#ifndef _GLIBCXX_STD_C
+# define _GLIBCXX_STD_C std
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_ALGO
+# define _GLIBCXX_END_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_CONTAINER
+# define _GLIBCXX_END_NAMESPACE_CONTAINER
+#endif
+
+// GLIBCXX_ABI Deprecated
+// Define if compatibility should be provided for -mlong-double-64.
+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+// Inline namespace for long double 128 mode.
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+namespace std
+{
+  inline namespace __gnu_cxx_ldbl128 { }
+}
+# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
+# define _GLIBCXX_END_NAMESPACE_LDBL }
+#else
+# define _GLIBCXX_NAMESPACE_LDBL
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
+# define _GLIBCXX_END_NAMESPACE_LDBL
+#endif
+
+// Assert.
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
+# define __glibcxx_assert(_Condition)
+#else
+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();
+  }
+}
+#define __glibcxx_assert(_Condition)				   	 \
+  do 									 \
+  {							      		 \
+    if (! (_Condition))                                                  \
+      std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+				#_Condition);				 \
+  } while (false)
+#endif
+
+// Macros for race detectors.
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
+// atomic (lock-free) synchronization to race detectors:
+// the race detector will infer a happens-before arc from the former to the
+// latter when they share the same argument pointer.
+//
+// The most frequent use case for these macros (and the only case in the
+// current implementation of the library) is atomic reference counting:
+//   void _M_remove_reference()
+//   {
+//     _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
+//     if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
+//       {
+//         _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
+//         _M_destroy(__a);
+//       }
+//   }
+// The annotations in this example tell the race detector that all memory
+// accesses occurred when the refcount was positive do not race with
+// memory accesses which occurred after the refcount became zero.
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
+#endif
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
+#endif
+
+// Macros for C linkage: define extern "C" linkage only when using C++.
+# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
+# define _GLIBCXX_END_EXTERN_C }
+
+#else // !__cplusplus
+# 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>
+
+// If platform uses neither visibility nor psuedo-visibility,
+// specify empty default for namespace annotation macros.
+#ifndef _GLIBCXX_PSEUDO_VISIBILITY
+# define _GLIBCXX_PSEUDO_VISIBILITY(V)
+#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
+
+
+// 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 settings discovered at configure time follow.
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `acosf' function. */
+/* #undef _GLIBCXX_HAVE_ACOSF */
+
+/* Define to 1 if you have the `acosl' function. */
+/* #undef _GLIBCXX_HAVE_ACOSL */
+
+/* Define to 1 if you have the `asinf' function. */
+/* #undef _GLIBCXX_HAVE_ASINF */
+
+/* Define to 1 if you have the `asinl' function. */
+/* #undef _GLIBCXX_HAVE_ASINL */
+
+/* Define to 1 if the target assembler supports .symver directive. */
+#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
+
+/* Define to 1 if you have the `atan2f' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2F */
+
+/* Define to 1 if you have the `atan2l' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2L */
+
+/* Define to 1 if you have the `atanf' function. */
+/* #undef _GLIBCXX_HAVE_ATANF */
+
+/* Define to 1 if you have the `atanl' function. */
+/* #undef _GLIBCXX_HAVE_ATANL */
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_CC_TLS */
+
+/* Define to 1 if you have the `ceilf' function. */
+/* #undef _GLIBCXX_HAVE_CEILF */
+
+/* Define to 1 if you have the `ceill' function. */
+/* #undef _GLIBCXX_HAVE_CEILL */
+
+/* Define to 1 if you have the <complex.h> header file. */
+/* #undef _GLIBCXX_HAVE_COMPLEX_H */
+
+/* Define to 1 if you have the `cosf' function. */
+/* #undef _GLIBCXX_HAVE_COSF */
+
+/* Define to 1 if you have the `coshf' function. */
+/* #undef _GLIBCXX_HAVE_COSHF */
+
+/* Define to 1 if you have the `coshl' function. */
+/* #undef _GLIBCXX_HAVE_COSHL */
+
+/* Define to 1 if you have the `cosl' function. */
+/* #undef _GLIBCXX_HAVE_COSL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _GLIBCXX_HAVE_DLFCN_H 1
+
+/* Define if EBADMSG exists. */
+#define _GLIBCXX_HAVE_EBADMSG 1
+
+/* Define if ECANCELED exists. */
+#define _GLIBCXX_HAVE_ECANCELED 1
+
+/* Define if EIDRM exists. */
+#define _GLIBCXX_HAVE_EIDRM 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define _GLIBCXX_HAVE_ENDIAN_H 1
+
+/* Define if ENODATA exists. */
+#define _GLIBCXX_HAVE_ENODATA 1
+
+/* Define if ENOLINK exists. */
+#define _GLIBCXX_HAVE_ENOLINK 1
+
+/* Define if ENOSR exists. */
+#define _GLIBCXX_HAVE_ENOSR 1
+
+/* Define if ENOSTR exists. */
+#define _GLIBCXX_HAVE_ENOSTR 1
+
+/* Define if ENOTRECOVERABLE exists. */
+#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
+
+/* Define if ENOTSUP exists. */
+#define _GLIBCXX_HAVE_ENOTSUP 1
+
+/* Define if EOVERFLOW exists. */
+#define _GLIBCXX_HAVE_EOVERFLOW 1
+
+/* Define if EOWNERDEAD exists. */
+#define _GLIBCXX_HAVE_EOWNERDEAD 1
+
+/* Define if EPROTO exists. */
+#define _GLIBCXX_HAVE_EPROTO 1
+
+/* Define if ETIME exists. */
+#define _GLIBCXX_HAVE_ETIME 1
+
+/* Define if ETXTBSY exists. */
+#define _GLIBCXX_HAVE_ETXTBSY 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+/* #undef _GLIBCXX_HAVE_EXECINFO_H */
+
+/* Define to 1 if you have the `expf' function. */
+/* #undef _GLIBCXX_HAVE_EXPF */
+
+/* Define to 1 if you have the `expl' function. */
+/* #undef _GLIBCXX_HAVE_EXPL */
+
+/* Define to 1 if you have the `fabsf' function. */
+/* #undef _GLIBCXX_HAVE_FABSF */
+
+/* Define to 1 if you have the `fabsl' function. */
+/* #undef _GLIBCXX_HAVE_FABSL */
+
+/* Define to 1 if you have the <fenv.h> header file. */
+#define _GLIBCXX_HAVE_FENV_H 1
+
+/* Define to 1 if you have the `finite' function. */
+/* #undef _GLIBCXX_HAVE_FINITE */
+
+/* Define to 1 if you have the `finitef' function. */
+/* #undef _GLIBCXX_HAVE_FINITEF */
+
+/* Define to 1 if you have the `finitel' function. */
+/* #undef _GLIBCXX_HAVE_FINITEL */
+
+/* Define to 1 if you have the <float.h> header file. */
+#define _GLIBCXX_HAVE_FLOAT_H 1
+
+/* Define to 1 if you have the `floorf' function. */
+/* #undef _GLIBCXX_HAVE_FLOORF */
+
+/* Define to 1 if you have the `floorl' function. */
+/* #undef _GLIBCXX_HAVE_FLOORL */
+
+/* Define to 1 if you have the `fmodf' function. */
+/* #undef _GLIBCXX_HAVE_FMODF */
+
+/* Define to 1 if you have the `fmodl' function. */
+/* #undef _GLIBCXX_HAVE_FMODL */
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef _GLIBCXX_HAVE_FPCLASS */
+
+/* Define to 1 if you have the <fp.h> header file. */
+/* #undef _GLIBCXX_HAVE_FP_H */
+
+/* Define to 1 if you have the `frexpf' function. */
+/* #undef _GLIBCXX_HAVE_FREXPF */
+
+/* Define to 1 if you have the `frexpl' function. */
+/* #undef _GLIBCXX_HAVE_FREXPL */
+
+/* Define if _Unwind_GetIPInfo is available. */
+#define _GLIBCXX_HAVE_GETIPINFO 1
+
+/* Define if gthr-default.h exists (meaning that threading support is
+   enabled). */
+#define _GLIBCXX_HAVE_GTHR_DEFAULT 1
+
+/* Define to 1 if you have the `hypot' function. */
+/* #undef _GLIBCXX_HAVE_HYPOT */
+
+/* Define to 1 if you have the `hypotf' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTF */
+
+/* Define to 1 if you have the `hypotl' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTL */
+
+/* Define if you have the iconv() function. */
+/* #undef _GLIBCXX_HAVE_ICONV */
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef _GLIBCXX_HAVE_IEEEFP_H */
+
+/* Define if int64_t is available in <stdint.h>. */
+#define _GLIBCXX_HAVE_INT64_T 1
+
+/* Define if int64_t is a long. */
+/* #undef _GLIBCXX_HAVE_INT64_T_LONG */
+
+/* Define if int64_t is a long long. */
+#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _GLIBCXX_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isinf' function. */
+/* #undef _GLIBCXX_HAVE_ISINF */
+
+/* Define to 1 if you have the `isinff' function. */
+/* #undef _GLIBCXX_HAVE_ISINFF */
+
+/* Define to 1 if you have the `isinfl' function. */
+/* #undef _GLIBCXX_HAVE_ISINFL */
+
+/* Define to 1 if you have the `isnan' function. */
+/* #undef _GLIBCXX_HAVE_ISNAN */
+
+/* Define to 1 if you have the `isnanf' function. */
+/* #undef _GLIBCXX_HAVE_ISNANF */
+
+/* Define to 1 if you have the `isnanl' function. */
+/* #undef _GLIBCXX_HAVE_ISNANL */
+
+/* Defined if iswblank exists. */
+/* #undef _GLIBCXX_HAVE_ISWBLANK */
+
+/* Define if LC_MESSAGES is available in <locale.h>. */
+#define _GLIBCXX_HAVE_LC_MESSAGES 1
+
+/* Define to 1 if you have the `ldexpf' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPF */
+
+/* Define to 1 if you have the `ldexpl' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPL */
+
+/* Define to 1 if you have the <libintl.h> header file. */
+/* #undef _GLIBCXX_HAVE_LIBINTL_H */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_AS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_DATA */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_FSIZE */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_RSS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_VMEM */
+
+/* Define if futex syscall is available. */
+/* #undef _GLIBCXX_HAVE_LINUX_FUTEX */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define _GLIBCXX_HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `log10f' function. */
+/* #undef _GLIBCXX_HAVE_LOG10F */
+
+/* Define to 1 if you have the `log10l' function. */
+/* #undef _GLIBCXX_HAVE_LOG10L */
+
+/* Define to 1 if you have the `logf' function. */
+/* #undef _GLIBCXX_HAVE_LOGF */
+
+/* Define to 1 if you have the `logl' function. */
+/* #undef _GLIBCXX_HAVE_LOGL */
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
+
+/* Define to 1 if you have the <machine/param.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
+
+/* Define if mbstate_t exists in wchar.h. */
+#define _GLIBCXX_HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _GLIBCXX_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `modf' function. */
+/* #undef _GLIBCXX_HAVE_MODF */
+
+/* Define to 1 if you have the `modff' function. */
+/* #undef _GLIBCXX_HAVE_MODFF */
+
+/* Define to 1 if you have the `modfl' function. */
+/* #undef _GLIBCXX_HAVE_MODFL */
+
+/* Define to 1 if you have the <nan.h> header file. */
+/* #undef _GLIBCXX_HAVE_NAN_H */
+
+/* Define if poll is available in <poll.h>. */
+/* #undef _GLIBCXX_HAVE_POLL */
+
+/* Define to 1 if you have the `powf' function. */
+/* #undef _GLIBCXX_HAVE_POWF */
+
+/* Define to 1 if you have the `powl' function. */
+/* #undef _GLIBCXX_HAVE_POWL */
+
+/* Define to 1 if you have the `qfpclass' function. */
+/* #undef _GLIBCXX_HAVE_QFPCLASS */
+
+/* Define to 1 if you have the `setenv' function. */
+/* #undef _GLIBCXX_HAVE_SETENV */
+
+/* Define to 1 if you have the `sincos' function. */
+/* #undef _GLIBCXX_HAVE_SINCOS */
+
+/* Define to 1 if you have the `sincosf' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSF */
+
+/* Define to 1 if you have the `sincosl' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSL */
+
+/* Define to 1 if you have the `sinf' function. */
+/* #undef _GLIBCXX_HAVE_SINF */
+
+/* Define to 1 if you have the `sinhf' function. */
+/* #undef _GLIBCXX_HAVE_SINHF */
+
+/* Define to 1 if you have the `sinhl' function. */
+/* #undef _GLIBCXX_HAVE_SINHL */
+
+/* Define to 1 if you have the `sinl' function. */
+/* #undef _GLIBCXX_HAVE_SINL */
+
+/* Define to 1 if you have the `sqrtf' function. */
+/* #undef _GLIBCXX_HAVE_SQRTF */
+
+/* Define to 1 if you have the `sqrtl' function. */
+/* #undef _GLIBCXX_HAVE_SQRTL */
+
+/* Define to 1 if you have the <stdbool.h> header file. */
+#define _GLIBCXX_HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _GLIBCXX_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _GLIBCXX_HAVE_STDLIB_H 1
+
+/* Define if strerror_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRERROR_L */
+
+/* Define if strerror_r is available in <string.h>. */
+#define _GLIBCXX_HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _GLIBCXX_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _GLIBCXX_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtof' function. */
+/* #undef _GLIBCXX_HAVE_STRTOF */
+
+/* Define to 1 if you have the `strtold' function. */
+/* #undef _GLIBCXX_HAVE_STRTOLD */
+
+/* Define if strxfrm_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRXFRM_L */
+
+/* Define to 1 if the target runtime linker supports binding the same symbol
+   to different versions. */
+/* #undef _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT */
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the <sys/isa_defs.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
+
+/* Define to 1 if you have the <sys/machine.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _GLIBCXX_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_SEM_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _GLIBCXX_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define _GLIBCXX_HAVE_SYS_UIO_H 1
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_IFREG */
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_ISREG */
+
+/* Define to 1 if you have the `tanf' function. */
+/* #undef _GLIBCXX_HAVE_TANF */
+
+/* Define to 1 if you have the `tanhf' function. */
+/* #undef _GLIBCXX_HAVE_TANHF */
+
+/* Define to 1 if you have the `tanhl' function. */
+/* #undef _GLIBCXX_HAVE_TANHL */
+
+/* Define to 1 if you have the `tanl' function. */
+/* #undef _GLIBCXX_HAVE_TANL */
+
+/* Define to 1 if you have the <tgmath.h> header file. */
+/* #undef _GLIBCXX_HAVE_TGMATH_H */
+
+/* Define to 1 if the target supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_TLS */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _GLIBCXX_HAVE_UNISTD_H 1
+
+/* Defined if vfwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VFWSCANF */
+
+/* Defined if vswscanf exists. */
+/* #undef _GLIBCXX_HAVE_VSWSCANF */
+
+/* Defined if vwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VWSCANF */
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define _GLIBCXX_HAVE_WCHAR_H 1
+
+/* Defined if wcstof exists. */
+/* #undef _GLIBCXX_HAVE_WCSTOF */
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define _GLIBCXX_HAVE_WCTYPE_H 1
+
+/* Define if writev is available in <sys/uio.h>. */
+/* #undef _GLIBCXX_HAVE_WRITEV */
+
+/* Define to 1 if you have the `_acosf' function. */
+/* #undef _GLIBCXX_HAVE__ACOSF */
+
+/* Define to 1 if you have the `_acosl' function. */
+/* #undef _GLIBCXX_HAVE__ACOSL */
+
+/* Define to 1 if you have the `_asinf' function. */
+/* #undef _GLIBCXX_HAVE__ASINF */
+
+/* Define to 1 if you have the `_asinl' function. */
+/* #undef _GLIBCXX_HAVE__ASINL */
+
+/* Define to 1 if you have the `_atan2f' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2F */
+
+/* Define to 1 if you have the `_atan2l' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2L */
+
+/* Define to 1 if you have the `_atanf' function. */
+/* #undef _GLIBCXX_HAVE__ATANF */
+
+/* Define to 1 if you have the `_atanl' function. */
+/* #undef _GLIBCXX_HAVE__ATANL */
+
+/* Define to 1 if you have the `_ceilf' function. */
+/* #undef _GLIBCXX_HAVE__CEILF */
+
+/* Define to 1 if you have the `_ceill' function. */
+/* #undef _GLIBCXX_HAVE__CEILL */
+
+/* Define to 1 if you have the `_cosf' function. */
+/* #undef _GLIBCXX_HAVE__COSF */
+
+/* Define to 1 if you have the `_coshf' function. */
+/* #undef _GLIBCXX_HAVE__COSHF */
+
+/* Define to 1 if you have the `_coshl' function. */
+/* #undef _GLIBCXX_HAVE__COSHL */
+
+/* Define to 1 if you have the `_cosl' function. */
+/* #undef _GLIBCXX_HAVE__COSL */
+
+/* Define to 1 if you have the `_expf' function. */
+/* #undef _GLIBCXX_HAVE__EXPF */
+
+/* Define to 1 if you have the `_expl' function. */
+/* #undef _GLIBCXX_HAVE__EXPL */
+
+/* Define to 1 if you have the `_fabsf' function. */
+/* #undef _GLIBCXX_HAVE__FABSF */
+
+/* Define to 1 if you have the `_fabsl' function. */
+/* #undef _GLIBCXX_HAVE__FABSL */
+
+/* Define to 1 if you have the `_finite' function. */
+/* #undef _GLIBCXX_HAVE__FINITE */
+
+/* Define to 1 if you have the `_finitef' function. */
+/* #undef _GLIBCXX_HAVE__FINITEF */
+
+/* Define to 1 if you have the `_finitel' function. */
+/* #undef _GLIBCXX_HAVE__FINITEL */
+
+/* Define to 1 if you have the `_floorf' function. */
+/* #undef _GLIBCXX_HAVE__FLOORF */
+
+/* Define to 1 if you have the `_floorl' function. */
+/* #undef _GLIBCXX_HAVE__FLOORL */
+
+/* Define to 1 if you have the `_fmodf' function. */
+/* #undef _GLIBCXX_HAVE__FMODF */
+
+/* Define to 1 if you have the `_fmodl' function. */
+/* #undef _GLIBCXX_HAVE__FMODL */
+
+/* Define to 1 if you have the `_fpclass' function. */
+/* #undef _GLIBCXX_HAVE__FPCLASS */
+
+/* Define to 1 if you have the `_frexpf' function. */
+/* #undef _GLIBCXX_HAVE__FREXPF */
+
+/* Define to 1 if you have the `_frexpl' function. */
+/* #undef _GLIBCXX_HAVE__FREXPL */
+
+/* Define to 1 if you have the `_hypot' function. */
+/* #undef _GLIBCXX_HAVE__HYPOT */
+
+/* Define to 1 if you have the `_hypotf' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTF */
+
+/* Define to 1 if you have the `_hypotl' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTL */
+
+/* Define to 1 if you have the `_isinf' function. */
+/* #undef _GLIBCXX_HAVE__ISINF */
+
+/* Define to 1 if you have the `_isinff' function. */
+/* #undef _GLIBCXX_HAVE__ISINFF */
+
+/* Define to 1 if you have the `_isinfl' function. */
+/* #undef _GLIBCXX_HAVE__ISINFL */
+
+/* Define to 1 if you have the `_isnan' function. */
+/* #undef _GLIBCXX_HAVE__ISNAN */
+
+/* Define to 1 if you have the `_isnanf' function. */
+/* #undef _GLIBCXX_HAVE__ISNANF */
+
+/* Define to 1 if you have the `_isnanl' function. */
+/* #undef _GLIBCXX_HAVE__ISNANL */
+
+/* Define to 1 if you have the `_ldexpf' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPF */
+
+/* Define to 1 if you have the `_ldexpl' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPL */
+
+/* Define to 1 if you have the `_log10f' function. */
+/* #undef _GLIBCXX_HAVE__LOG10F */
+
+/* Define to 1 if you have the `_log10l' function. */
+/* #undef _GLIBCXX_HAVE__LOG10L */
+
+/* Define to 1 if you have the `_logf' function. */
+/* #undef _GLIBCXX_HAVE__LOGF */
+
+/* Define to 1 if you have the `_logl' function. */
+/* #undef _GLIBCXX_HAVE__LOGL */
+
+/* Define to 1 if you have the `_modf' function. */
+/* #undef _GLIBCXX_HAVE__MODF */
+
+/* Define to 1 if you have the `_modff' function. */
+/* #undef _GLIBCXX_HAVE__MODFF */
+
+/* Define to 1 if you have the `_modfl' function. */
+/* #undef _GLIBCXX_HAVE__MODFL */
+
+/* Define to 1 if you have the `_powf' function. */
+/* #undef _GLIBCXX_HAVE__POWF */
+
+/* Define to 1 if you have the `_powl' function. */
+/* #undef _GLIBCXX_HAVE__POWL */
+
+/* Define to 1 if you have the `_qfpclass' function. */
+/* #undef _GLIBCXX_HAVE__QFPCLASS */
+
+/* Define to 1 if you have the `_sincos' function. */
+/* #undef _GLIBCXX_HAVE__SINCOS */
+
+/* Define to 1 if you have the `_sincosf' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSF */
+
+/* Define to 1 if you have the `_sincosl' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSL */
+
+/* Define to 1 if you have the `_sinf' function. */
+/* #undef _GLIBCXX_HAVE__SINF */
+
+/* Define to 1 if you have the `_sinhf' function. */
+/* #undef _GLIBCXX_HAVE__SINHF */
+
+/* Define to 1 if you have the `_sinhl' function. */
+/* #undef _GLIBCXX_HAVE__SINHL */
+
+/* Define to 1 if you have the `_sinl' function. */
+/* #undef _GLIBCXX_HAVE__SINL */
+
+/* Define to 1 if you have the `_sqrtf' function. */
+/* #undef _GLIBCXX_HAVE__SQRTF */
+
+/* Define to 1 if you have the `_sqrtl' function. */
+/* #undef _GLIBCXX_HAVE__SQRTL */
+
+/* Define to 1 if you have the `_tanf' function. */
+/* #undef _GLIBCXX_HAVE__TANF */
+
+/* Define to 1 if you have the `_tanhf' function. */
+/* #undef _GLIBCXX_HAVE__TANHF */
+
+/* Define to 1 if you have the `_tanhl' function. */
+/* #undef _GLIBCXX_HAVE__TANHL */
+
+/* Define to 1 if you have the `_tanl' function. */
+/* #undef _GLIBCXX_HAVE__TANL */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef _GLIBCXX_ICONV_CONST */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+/* #undef _GLIBCXX_PACKAGE */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _GLIBCXX_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _GLIBCXX_PACKAGE_NAME "package-unused"
+
+/* Define to the full name and version of this package. */
+#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
+
+/* Define to the one symbol short name of this package. */
+#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
+
+/* Define to the home page for this package. */
+#define _GLIBCXX_PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void *', as computed by sizeof. */
+/* #undef SIZEOF_VOID_P */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+/* #undef _GLIBCXX_VERSION */
+
+/* Define if builtin atomic operations for bool are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+
+/* Define if builtin atomic operations for short are supported on this host.
+   */
+#define _GLIBCXX_ATOMIC_BUILTINS_2 1
+
+/* Define if builtin atomic operations for int are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_4 1
+
+/* Define if builtin atomic operations for long long are supported on this
+   host. */
+/* #undef _GLIBCXX_ATOMIC_BUILTINS_8 */
+
+/* Define to use concept checking code from the boost libraries. */
+/* #undef _GLIBCXX_CONCEPT_CHECKS */
+
+/* Define if a fully dynamic basic_string is wanted. */
+/* #undef _GLIBCXX_FULLY_DYNAMIC_STRING */
+
+/* Define if gthreads library is available. */
+/* #undef _GLIBCXX_HAS_GTHREADS */
+
+/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
+#define _GLIBCXX_HOSTED 1
+
+/* Define if compatibility should be provided for -mlong-double-64. */
+
+/* Define if ptrdiff_t is int. */
+#define _GLIBCXX_PTRDIFF_T_IS_INT 1
+
+/* Define if using setrlimit to set resource limits during "make check" */
+/* #undef _GLIBCXX_RES_LIMITS */
+
+/* Define if size_t is unsigned int. */
+#define _GLIBCXX_SIZE_T_IS_UINT 1
+
+/* Define if the compiler is configured for setjmp/longjmp exceptions. */
+/* #undef _GLIBCXX_SJLJ_EXCEPTIONS */
+
+/* Define to the value of the EOF integer constant. */
+#define _GLIBCXX_STDIO_EOF -1
+
+/* Define to the value of the SEEK_CUR integer constant. */
+#define _GLIBCXX_STDIO_SEEK_CUR 1
+
+/* Define to the value of the SEEK_END integer constant. */
+#define _GLIBCXX_STDIO_SEEK_END 2
+
+/* Define to use symbol versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER */
+
+/* Define to use darwin versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_DARWIN */
+
+/* Define to use GNU versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU */
+
+/* Define to use GNU namespace versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
+
+/* Define to use Sun versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_SUN */
+
+/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
+   <stdio.h>, and <stdlib.h> can be used or exposed. */
+/* #undef _GLIBCXX_USE_C99 */
+
+/* Define if C99 functions in <complex.h> should be used in <complex>. Using
+   compiler builtins for these functions requires corresponding C99 library
+   functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX */
+
+/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
+   Using compiler builtins for these functions requires corresponding C99
+   library functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX_TR1 */
+
+/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_CTYPE_TR1 1
+
+/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_FENV_TR1 1
+
+/* Define if C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
+
+/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 */
+
+/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
+   in namespace std. */
+/* #undef _GLIBCXX_USE_C99_MATH */
+
+/* Define if C99 functions or macros in <math.h> should be imported in
+   <tr1/cmath> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_MATH_TR1 */
+
+/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_STDINT_TR1 1
+
+/* Defined if clock_gettime has monotonic clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_MONOTONIC */
+
+/* Defined if clock_gettime has realtime clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_REALTIME */
+
+/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
+   this host. */
+/* #undef _GLIBCXX_USE_DECIMAL_FLOAT */
+
+/* Defined if gettimeofday is available. */
+/* #undef _GLIBCXX_USE_GETTIMEOFDAY */
+
+/* Define if LFS support is available. */
+/* #undef _GLIBCXX_USE_LFS */
+
+/* Define if code specialized for long long should be used. */
+#define _GLIBCXX_USE_LONG_LONG 1
+
+/* Defined if nanosleep is available. */
+/* #undef _GLIBCXX_USE_NANOSLEEP */
+
+/* Define if NLS translations are to be used. */
+/* #undef _GLIBCXX_USE_NLS */
+
+/* Define if /dev/random and /dev/urandom are available for the random_device
+   of TR1 (Chapter 5.1). */
+#define _GLIBCXX_USE_RANDOM_TR1 1
+
+/* Defined if sched_yield is available. */
+/* #undef _GLIBCXX_USE_SCHED_YIELD */
+
+/* Define if code specialized for wchar_t should be used. */
+#define _GLIBCXX_USE_WCHAR_T 1
+
+#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
+# define _GLIBCXX_HAVE_ACOSF 1
+# define acosf _acosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
+# define _GLIBCXX_HAVE_ACOSL 1
+# define acosl _acosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
+# define _GLIBCXX_HAVE_ASINF 1
+# define asinf _asinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
+# define _GLIBCXX_HAVE_ASINL 1
+# define asinl _asinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
+# define _GLIBCXX_HAVE_ATAN2F 1
+# define atan2f _atan2f
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
+# define _GLIBCXX_HAVE_ATAN2L 1
+# define atan2l _atan2l
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
+# define _GLIBCXX_HAVE_ATANF 1
+# define atanf _atanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
+# define _GLIBCXX_HAVE_ATANL 1
+# define atanl _atanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
+# define _GLIBCXX_HAVE_CEILF 1
+# define ceilf _ceilf
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
+# define _GLIBCXX_HAVE_CEILL 1
+# define ceill _ceill
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
+# define _GLIBCXX_HAVE_COSF 1
+# define cosf _cosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
+# define _GLIBCXX_HAVE_COSHF 1
+# define coshf _coshf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
+# define _GLIBCXX_HAVE_COSHL 1
+# define coshl _coshl
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
+# define _GLIBCXX_HAVE_COSL 1
+# define cosl _cosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
+# define _GLIBCXX_HAVE_EXPF 1
+# define expf _expf
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
+# define _GLIBCXX_HAVE_EXPL 1
+# define expl _expl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
+# define _GLIBCXX_HAVE_FABSF 1
+# define fabsf _fabsf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
+# define _GLIBCXX_HAVE_FABSL 1
+# define fabsl _fabsl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
+# define _GLIBCXX_HAVE_FINITE 1
+# define finite _finite
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
+# define _GLIBCXX_HAVE_FINITEF 1
+# define finitef _finitef
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
+# define _GLIBCXX_HAVE_FINITEL 1
+# define finitel _finitel
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
+# define _GLIBCXX_HAVE_FLOORF 1
+# define floorf _floorf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
+# define _GLIBCXX_HAVE_FLOORL 1
+# define floorl _floorl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
+# define _GLIBCXX_HAVE_FMODF 1
+# define fmodf _fmodf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
+# define _GLIBCXX_HAVE_FMODL 1
+# define fmodl _fmodl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
+# define _GLIBCXX_HAVE_FPCLASS 1
+# define fpclass _fpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
+# define _GLIBCXX_HAVE_FREXPF 1
+# define frexpf _frexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
+# define _GLIBCXX_HAVE_FREXPL 1
+# define frexpl _frexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
+# define _GLIBCXX_HAVE_HYPOT 1
+# define hypot _hypot
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
+# define _GLIBCXX_HAVE_HYPOTF 1
+# define hypotf _hypotf
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
+# define _GLIBCXX_HAVE_HYPOTL 1
+# define hypotl _hypotl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
+# define _GLIBCXX_HAVE_ISINF 1
+# define isinf _isinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
+# define _GLIBCXX_HAVE_ISINFF 1
+# define isinff _isinff
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
+# define _GLIBCXX_HAVE_ISINFL 1
+# define isinfl _isinfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
+# define _GLIBCXX_HAVE_ISNAN 1
+# define isnan _isnan
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
+# define _GLIBCXX_HAVE_ISNANF 1
+# define isnanf _isnanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
+# define _GLIBCXX_HAVE_ISNANL 1
+# define isnanl _isnanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
+# define _GLIBCXX_HAVE_LDEXPF 1
+# define ldexpf _ldexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
+# define _GLIBCXX_HAVE_LDEXPL 1
+# define ldexpl _ldexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
+# define _GLIBCXX_HAVE_LOG10F 1
+# define log10f _log10f
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
+# define _GLIBCXX_HAVE_LOG10L 1
+# define log10l _log10l
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
+# define _GLIBCXX_HAVE_LOGF 1
+# define logf _logf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
+# define _GLIBCXX_HAVE_LOGL 1
+# define logl _logl
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
+# define _GLIBCXX_HAVE_MODF 1
+# define modf _modf
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
+# define _GLIBCXX_HAVE_MODFF 1
+# define modff _modff
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
+# define _GLIBCXX_HAVE_MODFL 1
+# define modfl _modfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
+# define _GLIBCXX_HAVE_POWF 1
+# define powf _powf
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
+# define _GLIBCXX_HAVE_POWL 1
+# define powl _powl
+#endif
+
+#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
+# define _GLIBCXX_HAVE_QFPCLASS 1
+# define qfpclass _qfpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
+# define _GLIBCXX_HAVE_SINCOS 1
+# define sincos _sincos
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
+# define _GLIBCXX_HAVE_SINCOSF 1
+# define sincosf _sincosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
+# define _GLIBCXX_HAVE_SINCOSL 1
+# define sincosl _sincosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
+# define _GLIBCXX_HAVE_SINF 1
+# define sinf _sinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
+# define _GLIBCXX_HAVE_SINHF 1
+# define sinhf _sinhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
+# define _GLIBCXX_HAVE_SINHL 1
+# define sinhl _sinhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
+# define _GLIBCXX_HAVE_SINL 1
+# define sinl _sinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
+# define _GLIBCXX_HAVE_SQRTF 1
+# define sqrtf _sqrtf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
+# define _GLIBCXX_HAVE_SQRTL 1
+# define sqrtl _sqrtl
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
+# define _GLIBCXX_HAVE_STRTOF 1
+# define strtof _strtof
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
+# define _GLIBCXX_HAVE_STRTOLD 1
+# define strtold _strtold
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
+# define _GLIBCXX_HAVE_TANF 1
+# define tanf _tanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
+# define _GLIBCXX_HAVE_TANHF 1
+# define tanhf _tanhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
+# define _GLIBCXX_HAVE_TANHL 1
+# define tanhl _tanhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
+# define _GLIBCXX_HAVE_TANL 1
+# define tanl _tanl
+#endif
+
+#endif // _GLIBCXX_CXX_CONFIG_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++io.h
@@ -0,0 +1,51 @@
+// Underlying io library details -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++io.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+// c_io_stdio.h - Defines for using "C" stdio.h
+
+#ifndef _GLIBCXX_CXX_IO_H
+#define _GLIBCXX_CXX_IO_H 1
+
+#include <cstdio>
+#include <bits/gthr.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef __gthread_mutex_t __c_lock;
+
+  // for basic_file.h
+  typedef FILE __c_file;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++locale.h
@@ -0,0 +1,93 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++locale.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#ifndef _GLIBCXX_CXX_LOCALE_H
+#define _GLIBCXX_CXX_LOCALE_H 1
+
+#pragma GCC system_header
+
+#include <clocale>
+
+#define _GLIBCXX_NUM_CATEGORIES 0
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef int*			__c_locale;
+
+  // Convert numeric value of type double and long double to string and
+  // return length of string.  If vsnprintf is available use it, otherwise
+  // fall back to the unsafe vsprintf which, in general, can be dangerous
+  // and should be avoided.
+  inline int
+  __convert_from_v(const __c_locale&, char* __out, 
+		   const int __size __attribute__((__unused__)),
+		   const char* __fmt, ...)
+  {
+    char* __old = std::setlocale(LC_NUMERIC, 0);
+    char* __sav = 0;
+    if (__old && __builtin_strcmp(__old, "C"))
+      {
+	const size_t __len = __builtin_strlen(__old) + 1;
+	__sav = new char[__len];
+	__builtin_memcpy(__sav, __old, __len);
+	std::setlocale(LC_NUMERIC, "C");
+      }
+
+    __builtin_va_list __args;
+    __builtin_va_start(__args, __fmt);
+
+#ifdef _GLIBCXX_USE_C99
+    const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
+#else
+    const int __ret = __builtin_vsprintf(__out, __fmt, __args);
+#endif
+
+    __builtin_va_end(__args);
+
+    if (__sav)
+      {
+	std::setlocale(LC_NUMERIC, __sav);
+	delete [] __sav;
+      }
+    return __ret;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cpu_defines.h
@@ -0,0 +1,33 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cpu_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_base.h
@@ -0,0 +1,60 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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
+//
+
+// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
+
+// Support for Solaris 2.5.1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int* 		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef char 		mask;
+    static const mask upper    	= _U;
+    static const mask lower 	= _L;
+    static const mask alpha 	= _U | _L;
+    static const mask digit 	= _N;
+    static const mask xdigit 	= _X | _N;
+    static const mask space 	= _S;
+    static const mask print 	= _P | _U | _L | _N | _B;
+    static const mask graph 	= _P | _U | _L | _N;
+    static const mask cntrl 	= _C;
+    static const mask punct 	= _P;
+    static const mask alnum 	= _U | _L | _N;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_inline.h
@@ -0,0 +1,74 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    while (__low < __high)
+      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && !this->is(__m, *__low))
+      ++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && this->is(__m, *__low) != 0)
+      ++__low;
+    return __low;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_noninline.h
@@ -0,0 +1,98 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_noninline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return _ctype_ + 1; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+		     size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x);
+  }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_toupper(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
+  }
+
+  const char*
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_tolower(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..2ac349d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
@@ -0,0 +1,82 @@
+// Control various target specific ABI tweaks.  ARM version.
+
+// Copyright (C) 2004, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cxxabi_tweaks.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{cxxabi.h}
+ */
+
+#ifndef _CXXABI_TWEAKS_H
+#define _CXXABI_TWEAKS_H 1
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{
+  extern "C" 
+  {
+#endif
+
+#ifdef __ARM_EABI__
+  // The ARM EABI uses the least significant bit of a 32-bit
+  // guard variable.  */
+#define _GLIBCXX_GUARD_TEST(x) ((*(x) & 1) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(x) = 1
+#define _GLIBCXX_GUARD_BIT 1
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
+  typedef int __guard;
+
+  // We also want the element size in array cookies.
+#define _GLIBCXX_ELTSIZE_IN_COOKIE 1
+  
+  // __cxa_vec_ctor should return a pointer to the array.
+  typedef void * __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return x
+  // Constructors and destructors return the "this" pointer.
+  typedef void * __cxa_cdtor_return_type;
+
+#else // __ARM_EABI__
+
+  // The generic ABI uses the first byte of a 64-bit guard variable.
+#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
+#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
+  __extension__ typedef int __guard __attribute__((mode (__DI__)));
+
+  // __cxa_vec_ctor has void return type.
+  typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+  // Constructors and destructors do not return a value.
+  typedef void __cxa_cdtor_return_type;
+
+#endif //!__ARM_EABI__
+
+#ifdef __cplusplus
+  }
+} // namespace __cxxabiv1
+#endif
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/error_constants.h
@@ -0,0 +1,178 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/error_constants.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{system_error}
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#define _GLIBCXX_ERROR_CONSTANTS 1
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  enum class errc
+    {
+      address_family_not_supported = 		EAFNOSUPPORT,
+      address_in_use = 				EADDRINUSE,
+      address_not_available = 			EADDRNOTAVAIL,
+      already_connected = 			EISCONN,
+      argument_list_too_long = 			E2BIG,
+      argument_out_of_domain = 			EDOM,
+      bad_address = 				EFAULT,
+      bad_file_descriptor = 			EBADF,
+
+#ifdef _GLIBCXX_HAVE_EBADMSG
+      bad_message = 				EBADMSG,
+#endif
+
+      broken_pipe = 				EPIPE,
+      connection_aborted = 			ECONNABORTED,
+      connection_already_in_progress = 		EALREADY,
+      connection_refused = 			ECONNREFUSED,
+      connection_reset = 			ECONNRESET,
+      cross_device_link = 			EXDEV,
+      destination_address_required = 		EDESTADDRREQ,
+      device_or_resource_busy = 		EBUSY,
+      directory_not_empty = 			ENOTEMPTY,
+      executable_format_error = 		ENOEXEC,
+      file_exists = 	       			EEXIST,
+      file_too_large = 				EFBIG,
+      filename_too_long = 			ENAMETOOLONG,
+      function_not_supported = 			ENOSYS,
+      host_unreachable = 			EHOSTUNREACH,
+
+#ifdef _GLIBCXX_HAVE_EIDRM
+      identifier_removed = 			EIDRM,
+#endif
+
+      illegal_byte_sequence = 			EILSEQ,
+      inappropriate_io_control_operation = 	ENOTTY,
+      interrupted = 				EINTR,
+      invalid_argument = 			EINVAL,
+      invalid_seek = 				ESPIPE,
+      io_error = 				EIO,
+      is_a_directory = 				EISDIR,
+      message_size = 				EMSGSIZE,
+      network_down = 				ENETDOWN,
+      network_reset = 				ENETRESET,
+      network_unreachable = 			ENETUNREACH,
+      no_buffer_space = 			ENOBUFS,
+      no_child_process = 			ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+      no_link = 				ENOLINK,
+#endif
+
+      no_lock_available = 			ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+      no_message_available = 			ENODATA, 
+#endif
+
+      no_message = 				ENOMSG, 
+      no_protocol_option = 			ENOPROTOOPT,
+      no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+      no_stream_resources = 			ENOSR,
+#endif
+
+      no_such_device_or_address = 		ENXIO,
+      no_such_device = 				ENODEV,
+      no_such_file_or_directory = 		ENOENT,
+      no_such_process = 			ESRCH,
+      not_a_directory = 			ENOTDIR,
+      not_a_socket = 				ENOTSOCK,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+      not_a_stream = 				ENOSTR,
+#endif
+
+      not_connected = 				ENOTCONN,
+      not_enough_memory = 			ENOMEM,
+
+#ifdef _GLIBCXX_HAVE_ENOTSUP
+      not_supported = 				ENOTSUP,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ECANCELED
+      operation_canceled = 			ECANCELED,
+#endif
+
+      operation_in_progress = 			EINPROGRESS,
+      operation_not_permitted = 		EPERM,
+      operation_not_supported = 		EOPNOTSUPP,
+      operation_would_block = 			EWOULDBLOCK,
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead = 				EOWNERDEAD,
+#endif
+
+      permission_denied = 			EACCES,
+
+#ifdef _GLIBCXX_HAVE_EPROTO
+      protocol_error = 				EPROTO,
+#endif
+
+      protocol_not_supported = 			EPROTONOSUPPORT,
+      read_only_file_system = 			EROFS,
+      resource_deadlock_would_occur = 		EDEADLK,
+      resource_unavailable_try_again = 		EAGAIN,
+      result_out_of_range = 			ERANGE,
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+      stream_timeout = 				ETIME,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETXTBSY
+      text_file_busy = 				ETXTBSY,
+#endif
+
+      timed_out = 				ETIMEDOUT,
+      too_many_files_open_in_system = 		ENFILE,
+      too_many_files_open = 			EMFILE,
+      too_many_links = 				EMLINK,
+      too_many_symbolic_link_levels = 		ELOOP,
+
+#ifdef _GLIBCXX_HAVE_EOVERFLOW
+      value_too_large = 			EOVERFLOW,
+#endif
+
+      wrong_protocol_type = 			EPROTOTYPE
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/extc++.h
@@ -0,0 +1,71 @@
+// 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.
+ */
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/stdtr1c++.h>
+#endif
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-default.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-default.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-posix.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-single.h
@@ -0,0 +1,292 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_SINGLE_H
+#define _GLIBCXX_GCC_GTHR_SINGLE_H
+
+/* Just provide compatibility for mutex handling.  */
+
+typedef int __gthread_key_t;
+typedef int __gthread_once_t;
+typedef int __gthread_mutex_t;
+typedef int __gthread_recursive_mutex_t;
+
+#define __GTHREAD_ONCE_INIT 0
+#define __GTHREAD_MUTEX_INIT 0
+#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
+
+#define _GLIBCXX_UNUSED __attribute__((unused))
+
+#ifdef _LIBOBJC
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return NULL;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+  return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  return;
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  /* No thread support available */
+  /* Should we really exit the program */
+  /* exit (&__objc_thread_exit_status); */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  /* No thread support, use 1.  */
+  return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  thread_local_storage = value;
+  return 0;
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
+			       objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 0;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int _GLIBCXX_UNUSED
+__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static int _GLIBCXX_UNUSED
+__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+#endif /* _LIBOBJC */
+
+#undef _GLIBCXX_UNUSED
+
+#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-tpf.h
@@ -0,0 +1,229 @@
+/* Threads compatibility routines for libgcc2 and libobjc.
+   Compile this one with gcc.
+   Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* TPF needs its own version of gthr-*.h because TPF always links to
+   the thread library.  However, for performance reasons we still do not
+   want to issue thread api calls unless a check is made to see that we
+   are running as a thread.  */
+
+#ifndef _GLIBCXX_GCC_GTHR_TPF_H
+#define _GLIBCXX_GCC_GTHR_TPF_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#endif
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+
+#define NOTATHREAD   00
+#define ECBBASEPTR (unsigned long int) *(unsigned int *)0x00000514u
+#define ECBPG2PTR  ECBBASEPTR + 0x1000
+#define CE2THRCPTR *((unsigned char *)(ECBPG2PTR + 16))
+#define __tpf_pthread_active() (CE2THRCPTR != NOTATHREAD)
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# define __gthrw(name) \
+  static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw(name)
+# define __gthrw_(name) name
+#endif
+
+__gthrw(pthread_once)
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+__gthrw(pthread_create)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_create) (__key, __dtor);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_delete) (__key);
+  else
+    return -1;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_getspecific) (__key);
+  else
+    return NULL;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_setspecific) (__key, __ptr);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_lock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_trylock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_unlock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+
+
+#endif /* ! _GLIBCXX_GCC_GTHR_TPF_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr.h
@@ -0,0 +1,173 @@
+/* Threads compatibility routines for libgcc2.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_H
+#define _GLIBCXX_GCC_GTHR_H
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility push(default)
+#endif
+
+/* If this file is compiled with threads support, it must
+       #define __GTHREADS 1
+   to indicate that threads support is present.  Also it has define
+   function
+     int __gthread_active_p ()
+   that returns 1 if thread system is active, 0 if not.
+
+   The threads interface must define the following types:
+     __gthread_key_t
+     __gthread_once_t
+     __gthread_mutex_t
+     __gthread_recursive_mutex_t
+
+   The threads interface must define the following macros:
+
+     __GTHREAD_ONCE_INIT
+     		to initialize __gthread_once_t
+     __GTHREAD_MUTEX_INIT
+     		to initialize __gthread_mutex_t to get a fast
+		non-recursive mutex.
+     __GTHREAD_MUTEX_INIT_FUNCTION
+     		some systems can't initialize a mutex without a
+		function call.  On such systems, define this to a
+		function which looks like this:
+		  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
+		Don't define __GTHREAD_MUTEX_INIT in this case
+     __GTHREAD_RECURSIVE_MUTEX_INIT
+     __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
+     		as above, but for a recursive mutex.
+
+   The threads interface must define the following static functions:
+
+     int __gthread_once (__gthread_once_t *once, void (*func) ())
+
+     int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
+     int __gthread_key_delete (__gthread_key_t key)
+
+     void *__gthread_getspecific (__gthread_key_t key)
+     int __gthread_setspecific (__gthread_key_t key, const void *ptr)
+
+     int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
+
+     int __gthread_mutex_lock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
+
+     int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
+
+   The following are supported in POSIX threads only. They are required to
+   fix a deadlock in static initialization inside libsupc++. The header file
+   gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
+   features are supported.
+
+   Types:
+     __gthread_cond_t
+
+   Macros:
+     __GTHREAD_COND_INIT
+     __GTHREAD_COND_INIT_FUNCTION
+
+   Interface:
+     int __gthread_cond_broadcast (__gthread_cond_t *cond);
+     int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
+     int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
+					__gthread_recursive_mutex_t *mutex);
+
+   All functions returning int should return zero on success or the error
+   number.  If the operation is not supported, -1 is returned.
+
+   If the following are also defined, you should
+     #define __GTHREADS_CXX0X 1
+   to enable the c++0x thread library.
+
+   Types:
+     __gthread_t
+     __gthread_time_t
+
+   Interface:
+     int __gthread_create (__gthread_t *thread, void *(*func) (void*),
+                           void *args);
+     int __gthread_join (__gthread_t thread, void **value_ptr);
+     int __gthread_detach (__gthread_t thread);
+     int __gthread_equal (__gthread_t t1, __gthread_t t2);
+     __gthread_t __gthread_self (void);
+     int __gthread_yield (void);
+
+     int __gthread_mutex_timedlock (__gthread_mutex_t *m,
+                                    const __gthread_time_t *abs_timeout);
+     int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
+                                          const __gthread_time_t *abs_time);
+
+     int __gthread_cond_signal (__gthread_cond_t *cond);
+     int __gthread_cond_timedwait (__gthread_cond_t *cond,
+                                   __gthread_mutex_t *mutex,
+                                   const __gthread_time_t *abs_timeout);
+     int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond,
+                                             __gthread_recursive_mutex_t *mutex,
+                                             const __gthread_time_t *abs_time)
+
+   Currently supported threads packages are
+     TPF threads with -D__tpf__
+     POSIX/Unix98 threads with -D_PTHREADS
+     POSIX/Unix95 threads with -D_PTHREADS95
+     DCE threads with -D_DCE_THREADS
+     Solaris/UI threads with -D_SOLARIS_THREADS
+
+*/
+
+/* Check first for thread specific defines.  */
+#if defined (_GLIBCXX___tpf_GLIBCXX___)
+#include <bits/gthr-tpf.h>
+#elif _GLIBCXX__PTHREADS
+#include <bits/gthr-posix.h>
+#elif _GLIBCXX__PTHREADS95
+#include <bits/gthr-posix95.h>
+#elif _GLIBCXX__DCE_THREADS
+#include <bits/gthr-dce.h>
+#elif _GLIBCXX__SOLARIS_THREADS
+#include <bits/gthr-solaris.h>
+
+/* Include GTHREAD_FILE if one is defined.  */
+#elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
+#if __GXX_WEAK__
+#ifndef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 1
+#endif
+#endif
+#include <bits/gthr-default.h>
+
+/* Fallback to single thread definitions.  */
+#else
+#include <bits/gthr-single.h>
+#endif
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility pop
+#endif
+
+#endif /* ! _GLIBCXX_GCC_GTHR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/messages_members.h
@@ -0,0 +1,93 @@
+// std::messages implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/messages_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Non-virtual member functions.
+  template<typename _CharT>
+     messages<_CharT>::messages(size_t __refs)
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+     messages<_CharT>::messages(__c_locale, const char*, size_t __refs) 
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
+			   const char*) const
+    { return this->do_open(__s, __loc); }
+
+  // Virtual member functions.
+  template<typename _CharT>
+    messages<_CharT>::~messages()
+    { _S_destroy_c_locale(_M_c_locale_messages); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
+    { return 0; }
+
+  template<typename _CharT>
+    typename messages<_CharT>::string_type  
+    messages<_CharT>::do_get(catalog, int, int, 
+			     const string_type& __dfault) const
+    { return __dfault; }
+
+  template<typename _CharT>
+    void    
+    messages<_CharT>::do_close(catalog) const 
+    { }
+
+   // messages_byname
+   template<typename _CharT>
+     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
+     : messages<_CharT>(__refs) 
+     { 
+	if (__builtin_strcmp(__s, "C") != 0
+	    && __builtin_strcmp(__s, "POSIX") != 0)
+	  {
+	    this->_S_destroy_c_locale(this->_M_c_locale_messages);
+	    this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
+	  }
+     }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/os_defines.h
@@ -0,0 +1,36 @@
+// Specific definitions for Bionic  -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/os_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdc++.h
@@ -0,0 +1,116 @@
+// C++ includes used for precompiling -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+#ifndef _GLIBCXX_NO_ASSERT
+#include <cassert>
+#endif
+#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 <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 <atomic>
+#include <chrono>
+#include <condition_variable>
+#include <forward_list>
+#include <future>
+#include <initializer_list>
+#include <mutex>
+#include <random>
+#include <ratio>
+#include <regex>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <typeindex>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdtr1c++.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/time_members.h
@@ -0,0 +1,94 @@
+// std::time_get, std::time_put implementation, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/time_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(size_t __refs) 
+    : facet(__refs), _M_data(0)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
+    : facet(__refs), _M_data(__cache)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, 
+				     size_t __refs) 
+    : facet(__refs), _M_data(0)
+    {
+      if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
+	{
+	  const size_t __len = __builtin_strlen(__s) + 1;
+	  char* __tmp = new char[__len];
+	  __builtin_memcpy(__tmp, __s, __len);
+	  _M_name_timepunct = __tmp;
+	}
+      else
+	_M_name_timepunct = _S_get_c_name();
+
+      __try
+	{ _M_initialize_timepunct(__cloc); }
+      __catch(...)
+	{
+	  if (_M_name_timepunct != _S_get_c_name())
+	    delete [] _M_name_timepunct;
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::~__timepunct()
+    { 
+      if (_M_name_timepunct != _S_get_c_name())
+	delete [] _M_name_timepunct;
+      delete _M_data;
+      _S_destroy_c_locale(_M_c_locale_timepunct); 
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_shared.so
new file mode 100755
index 0000000..7550d91
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
new file mode 100644
index 0000000..c818709
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a
new file mode 100644
index 0000000..6f590ec
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/atomic_word.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/basic_file.h
@@ -0,0 +1,111 @@
+// Wrapper of C-language FILE struct -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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  File-based streams
+//
+
+/** @file bits/basic_file.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
+#define _GLIBCXX_BASIC_FILE_STDIO_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/c++io.h>  // for __c_lock and __c_file
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Generic declaration.
+  template<typename _CharT>
+    class __basic_file; 
+
+  // Specialization.
+  template<>
+    class __basic_file<char>
+    {
+      // Underlying data source/sink.
+      __c_file* 	_M_cfile;
+
+      // True iff we opened _M_cfile, and thus must close it ourselves.
+      bool 		_M_cfile_created;
+
+    public:
+      __basic_file(__c_lock* __lock = 0) throw ();
+
+      __basic_file* 
+      open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
+
+      __basic_file*
+      sys_open(__c_file* __file, ios_base::openmode);
+
+      __basic_file*
+      sys_open(int __fd, ios_base::openmode __mode) throw ();
+
+      __basic_file* 
+      close(); 
+
+      _GLIBCXX_PURE bool 
+      is_open() const throw ();
+
+      _GLIBCXX_PURE int 
+      fd() throw ();
+
+      _GLIBCXX_PURE __c_file*
+      file() throw ();
+
+      ~__basic_file();
+
+      streamsize 
+      xsputn(const char* __s, streamsize __n);
+
+      streamsize 
+      xsputn_2(const char* __s1, streamsize __n1,
+	       const char* __s2, streamsize __n2);
+
+      streamsize 
+      xsgetn(char* __s, streamsize __n);
+
+      streamoff
+      seekoff(streamoff __off, ios_base::seekdir __way) throw ();
+
+      int 
+      sync();
+
+      streamsize
+      showmanyc();
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif	
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++allocator.h
@@ -0,0 +1,37 @@
+// Base to std::allocator -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++allocator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _GLIBCXX_CXX_ALLOCATOR_H
+#define _GLIBCXX_CXX_ALLOCATOR_H 1
+
+// Define new_allocator as the base class to std::allocator.
+#include <ext/new_allocator.h>
+#define __glibcxx_base_allocator  __gnu_cxx::new_allocator
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++config.h
new file mode 100644
index 0000000..2f0c5c6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++config.h
@@ -0,0 +1,1569 @@
+// Predefined symbols and macros -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++config.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#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__ 20120106
+
+// Macros for various attributes.
+//   _GLIBCXX_PURE
+//   _GLIBCXX_CONST
+//   _GLIBCXX_NORETURN
+//   _GLIBCXX_NOTHROW
+//   _GLIBCXX_VISIBILITY
+#ifndef _GLIBCXX_PURE
+# define _GLIBCXX_PURE __attribute__ ((__pure__))
+#endif
+
+#ifndef _GLIBCXX_CONST
+# define _GLIBCXX_CONST __attribute__ ((__const__))
+#endif
+
+#ifndef _GLIBCXX_NORETURN
+# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+#ifndef _GLIBCXX_NOTHROW
+# ifdef __cplusplus
+#  define _GLIBCXX_NOTHROW throw()
+# else
+#  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
+# endif
+#endif
+
+// Macros for visibility attributes.
+//   _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+//   _GLIBCXX_VISIBILITY
+# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
+
+#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
+#else
+// If this is not supplied by the OS-specific or CPU-specific
+// headers included below, it will be defined to an empty default.
+# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
+#endif
+
+// Macros for deprecated attributes.
+//   _GLIBCXX_USE_DEPRECATED
+//   _GLIBCXX_DEPRECATED
+#ifndef _GLIBCXX_USE_DEPRECATED
+# define _GLIBCXX_USE_DEPRECATED 1
+#endif
+
+#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
+#else
+# define _GLIBCXX_DEPRECATED
+#endif
+
+#if __cplusplus
+
+// Macro for constexpr, to support in mixed 03/0x mode.
+#ifndef _GLIBCXX_CONSTEXPR
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+#  define _GLIBCXX_CONSTEXPR constexpr
+#  define _GLIBCXX_USE_CONSTEXPR constexpr
+# else
+#  define _GLIBCXX_CONSTEXPR
+#  define _GLIBCXX_USE_CONSTEXPR const
+# endif
+#endif
+
+// Macro for extern template, ie controling template linkage via use
+// of extern keyword on template declaration. As documented in the g++
+// manual, 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.
+// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
+// templates only in basic_string, thus activating its debug-mode
+// checks even at -O0.
+# define _GLIBCXX_EXTERN_TEMPLATE 1
+
+/*
+  Outline of libstdc++ namespaces.
+
+  namespace std
+  {
+    namespace __debug { }
+    namespace __parallel { }
+    namespace __profile { }
+    namespace __cxx1998 { }
+
+    namespace __detail { }
+
+    namespace rel_ops { }
+
+    namespace tr1
+    {
+      namespace placeholders { }
+      namespace regex_constants { }
+      namespace __detail { }
+    }
+
+    namespace decimal { }
+
+    namespace chrono { }
+    namespace placeholders { }
+    namespace regex_constants { }
+    namespace this_thread { }
+  }
+
+  namespace abi { }
+
+  namespace __gnu_cxx
+  {
+    namespace __detail { }
+  }
+
+  For full details see:
+  http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
+*/
+namespace std
+{
+  typedef __SIZE_TYPE__ 	size_t;
+  typedef __PTRDIFF_TYPE__	ptrdiff_t;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  typedef decltype(nullptr)	nullptr_t;
+#endif
+}
+
+
+// Defined if inline namespaces are used for versioning.
+# define _GLIBCXX_INLINE_VERSION 0 
+
+// Inline namespace for symbol versioning.
+#if _GLIBCXX_INLINE_VERSION
+
+namespace std
+{
+  inline namespace __7 { }
+
+  namespace rel_ops { inline namespace __7 { } }
+
+  namespace tr1
+  {
+    inline namespace __7 { }
+    namespace placeholders { inline namespace __7 { } }
+    namespace regex_constants { inline namespace __7 { } }
+    namespace __detail { inline namespace __7 { } }
+  }
+
+  namespace decimal { inline namespace __7 { } }
+
+  namespace chrono { inline namespace __7 { } }
+  namespace placeholders { inline namespace __7 { } }
+  namespace regex_constants { inline namespace __7 { } }
+  namespace this_thread { inline namespace __7 { } }
+
+  namespace __detail { inline namespace __7 { } }
+  namespace __regex { inline namespace __7 { } }
+}
+
+namespace __gnu_cxx
+{
+  inline namespace __7 { }
+  namespace __detail { inline namespace __7 { } }
+}
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 {
+# define _GLIBCXX_END_NAMESPACE_VERSION }
+#else
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+
+// Inline namespaces for special modes: debug, parallel, profile.
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
+    || defined(_GLIBCXX_PROFILE)
+namespace std
+{
+  // Non-inline namespace for components replaced by alternates in active mode.
+  namespace __cxx1998
+  {
+#if _GLIBCXX_INLINE_VERSION
+ inline namespace __7 { }
+#endif
+  }
+
+  // Inline namespace for debug mode.
+# ifdef _GLIBCXX_DEBUG
+  inline namespace __debug { }
+# endif
+
+  // Inline namespaces for parallel mode.
+# ifdef _GLIBCXX_PARALLEL
+  inline namespace __parallel { }
+# endif
+
+  // Inline namespaces for profile mode
+# ifdef _GLIBCXX_PROFILE
+  inline namespace __profile { }
+# endif
+}
+
+// Check for invalid usage and unsupported mixed-mode use.
+# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+
+// Check for invalid use due to lack for weak symbols.
+# if __NO_INLINE__ && !__GXX_WEAK__
+#  warning currently using inlined namespace mode which may fail \
+   without inlining due to lack of weak symbols
+# endif
+#endif
+
+// Macros for namespace scope. Either namespace std:: or the name
+// of some nested namespace within it corresponding to the active mode.
+// _GLIBCXX_STD_A
+// _GLIBCXX_STD_C
+//
+// Macros for opening/closing conditional namespaces.
+// _GLIBCXX_BEGIN_NAMESPACE_ALGO
+// _GLIBCXX_END_NAMESPACE_ALGO
+// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+// _GLIBCXX_END_NAMESPACE_CONTAINER
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
+# define _GLIBCXX_STD_C __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
+	 namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_CONTAINER \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+# undef _GLIBCXX_EXTERN_TEMPLATE
+#  define _GLIBCXX_EXTERN_TEMPLATE 1 -1
+#endif
+
+#ifdef _GLIBCXX_PARALLEL
+# define _GLIBCXX_STD_A __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
+	 namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_ALGO \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+#ifndef _GLIBCXX_STD_A
+# define _GLIBCXX_STD_A std
+#endif
+
+#ifndef _GLIBCXX_STD_C
+# define _GLIBCXX_STD_C std
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_ALGO
+# define _GLIBCXX_END_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_CONTAINER
+# define _GLIBCXX_END_NAMESPACE_CONTAINER
+#endif
+
+// GLIBCXX_ABI Deprecated
+// Define if compatibility should be provided for -mlong-double-64.
+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+// Inline namespace for long double 128 mode.
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+namespace std
+{
+  inline namespace __gnu_cxx_ldbl128 { }
+}
+# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
+# define _GLIBCXX_END_NAMESPACE_LDBL }
+#else
+# define _GLIBCXX_NAMESPACE_LDBL
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
+# define _GLIBCXX_END_NAMESPACE_LDBL
+#endif
+
+// Assert.
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
+# define __glibcxx_assert(_Condition)
+#else
+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();
+  }
+}
+#define __glibcxx_assert(_Condition)				   	 \
+  do 									 \
+  {							      		 \
+    if (! (_Condition))                                                  \
+      std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+				#_Condition);				 \
+  } while (false)
+#endif
+
+// Macros for race detectors.
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
+// atomic (lock-free) synchronization to race detectors:
+// the race detector will infer a happens-before arc from the former to the
+// latter when they share the same argument pointer.
+//
+// The most frequent use case for these macros (and the only case in the
+// current implementation of the library) is atomic reference counting:
+//   void _M_remove_reference()
+//   {
+//     _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
+//     if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
+//       {
+//         _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
+//         _M_destroy(__a);
+//       }
+//   }
+// The annotations in this example tell the race detector that all memory
+// accesses occurred when the refcount was positive do not race with
+// memory accesses which occurred after the refcount became zero.
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
+#endif
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
+#endif
+
+// Macros for C linkage: define extern "C" linkage only when using C++.
+# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
+# define _GLIBCXX_END_EXTERN_C }
+
+#else // !__cplusplus
+# 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>
+
+// If platform uses neither visibility nor psuedo-visibility,
+// specify empty default for namespace annotation macros.
+#ifndef _GLIBCXX_PSEUDO_VISIBILITY
+# define _GLIBCXX_PSEUDO_VISIBILITY(V)
+#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
+
+
+// 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 settings discovered at configure time follow.
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `acosf' function. */
+/* #undef _GLIBCXX_HAVE_ACOSF */
+
+/* Define to 1 if you have the `acosl' function. */
+/* #undef _GLIBCXX_HAVE_ACOSL */
+
+/* Define to 1 if you have the `asinf' function. */
+/* #undef _GLIBCXX_HAVE_ASINF */
+
+/* Define to 1 if you have the `asinl' function. */
+/* #undef _GLIBCXX_HAVE_ASINL */
+
+/* Define to 1 if the target assembler supports .symver directive. */
+#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
+
+/* Define to 1 if you have the `atan2f' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2F */
+
+/* Define to 1 if you have the `atan2l' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2L */
+
+/* Define to 1 if you have the `atanf' function. */
+/* #undef _GLIBCXX_HAVE_ATANF */
+
+/* Define to 1 if you have the `atanl' function. */
+/* #undef _GLIBCXX_HAVE_ATANL */
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_CC_TLS */
+
+/* Define to 1 if you have the `ceilf' function. */
+/* #undef _GLIBCXX_HAVE_CEILF */
+
+/* Define to 1 if you have the `ceill' function. */
+/* #undef _GLIBCXX_HAVE_CEILL */
+
+/* Define to 1 if you have the <complex.h> header file. */
+/* #undef _GLIBCXX_HAVE_COMPLEX_H */
+
+/* Define to 1 if you have the `cosf' function. */
+/* #undef _GLIBCXX_HAVE_COSF */
+
+/* Define to 1 if you have the `coshf' function. */
+/* #undef _GLIBCXX_HAVE_COSHF */
+
+/* Define to 1 if you have the `coshl' function. */
+/* #undef _GLIBCXX_HAVE_COSHL */
+
+/* Define to 1 if you have the `cosl' function. */
+/* #undef _GLIBCXX_HAVE_COSL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _GLIBCXX_HAVE_DLFCN_H 1
+
+/* Define if EBADMSG exists. */
+#define _GLIBCXX_HAVE_EBADMSG 1
+
+/* Define if ECANCELED exists. */
+#define _GLIBCXX_HAVE_ECANCELED 1
+
+/* Define if EIDRM exists. */
+#define _GLIBCXX_HAVE_EIDRM 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define _GLIBCXX_HAVE_ENDIAN_H 1
+
+/* Define if ENODATA exists. */
+#define _GLIBCXX_HAVE_ENODATA 1
+
+/* Define if ENOLINK exists. */
+#define _GLIBCXX_HAVE_ENOLINK 1
+
+/* Define if ENOSR exists. */
+#define _GLIBCXX_HAVE_ENOSR 1
+
+/* Define if ENOSTR exists. */
+#define _GLIBCXX_HAVE_ENOSTR 1
+
+/* Define if ENOTRECOVERABLE exists. */
+#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
+
+/* Define if ENOTSUP exists. */
+#define _GLIBCXX_HAVE_ENOTSUP 1
+
+/* Define if EOVERFLOW exists. */
+#define _GLIBCXX_HAVE_EOVERFLOW 1
+
+/* Define if EOWNERDEAD exists. */
+#define _GLIBCXX_HAVE_EOWNERDEAD 1
+
+/* Define if EPROTO exists. */
+#define _GLIBCXX_HAVE_EPROTO 1
+
+/* Define if ETIME exists. */
+#define _GLIBCXX_HAVE_ETIME 1
+
+/* Define if ETXTBSY exists. */
+#define _GLIBCXX_HAVE_ETXTBSY 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+/* #undef _GLIBCXX_HAVE_EXECINFO_H */
+
+/* Define to 1 if you have the `expf' function. */
+/* #undef _GLIBCXX_HAVE_EXPF */
+
+/* Define to 1 if you have the `expl' function. */
+/* #undef _GLIBCXX_HAVE_EXPL */
+
+/* Define to 1 if you have the `fabsf' function. */
+/* #undef _GLIBCXX_HAVE_FABSF */
+
+/* Define to 1 if you have the `fabsl' function. */
+/* #undef _GLIBCXX_HAVE_FABSL */
+
+/* Define to 1 if you have the <fenv.h> header file. */
+#define _GLIBCXX_HAVE_FENV_H 1
+
+/* Define to 1 if you have the `finite' function. */
+/* #undef _GLIBCXX_HAVE_FINITE */
+
+/* Define to 1 if you have the `finitef' function. */
+/* #undef _GLIBCXX_HAVE_FINITEF */
+
+/* Define to 1 if you have the `finitel' function. */
+/* #undef _GLIBCXX_HAVE_FINITEL */
+
+/* Define to 1 if you have the <float.h> header file. */
+#define _GLIBCXX_HAVE_FLOAT_H 1
+
+/* Define to 1 if you have the `floorf' function. */
+/* #undef _GLIBCXX_HAVE_FLOORF */
+
+/* Define to 1 if you have the `floorl' function. */
+/* #undef _GLIBCXX_HAVE_FLOORL */
+
+/* Define to 1 if you have the `fmodf' function. */
+/* #undef _GLIBCXX_HAVE_FMODF */
+
+/* Define to 1 if you have the `fmodl' function. */
+/* #undef _GLIBCXX_HAVE_FMODL */
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef _GLIBCXX_HAVE_FPCLASS */
+
+/* Define to 1 if you have the <fp.h> header file. */
+/* #undef _GLIBCXX_HAVE_FP_H */
+
+/* Define to 1 if you have the `frexpf' function. */
+/* #undef _GLIBCXX_HAVE_FREXPF */
+
+/* Define to 1 if you have the `frexpl' function. */
+/* #undef _GLIBCXX_HAVE_FREXPL */
+
+/* Define if _Unwind_GetIPInfo is available. */
+#define _GLIBCXX_HAVE_GETIPINFO 1
+
+/* Define if gthr-default.h exists (meaning that threading support is
+   enabled). */
+#define _GLIBCXX_HAVE_GTHR_DEFAULT 1
+
+/* Define to 1 if you have the `hypot' function. */
+/* #undef _GLIBCXX_HAVE_HYPOT */
+
+/* Define to 1 if you have the `hypotf' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTF */
+
+/* Define to 1 if you have the `hypotl' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTL */
+
+/* Define if you have the iconv() function. */
+/* #undef _GLIBCXX_HAVE_ICONV */
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef _GLIBCXX_HAVE_IEEEFP_H */
+
+/* Define if int64_t is available in <stdint.h>. */
+#define _GLIBCXX_HAVE_INT64_T 1
+
+/* Define if int64_t is a long. */
+/* #undef _GLIBCXX_HAVE_INT64_T_LONG */
+
+/* Define if int64_t is a long long. */
+#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _GLIBCXX_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isinf' function. */
+/* #undef _GLIBCXX_HAVE_ISINF */
+
+/* Define to 1 if you have the `isinff' function. */
+/* #undef _GLIBCXX_HAVE_ISINFF */
+
+/* Define to 1 if you have the `isinfl' function. */
+/* #undef _GLIBCXX_HAVE_ISINFL */
+
+/* Define to 1 if you have the `isnan' function. */
+/* #undef _GLIBCXX_HAVE_ISNAN */
+
+/* Define to 1 if you have the `isnanf' function. */
+/* #undef _GLIBCXX_HAVE_ISNANF */
+
+/* Define to 1 if you have the `isnanl' function. */
+/* #undef _GLIBCXX_HAVE_ISNANL */
+
+/* Defined if iswblank exists. */
+/* #undef _GLIBCXX_HAVE_ISWBLANK */
+
+/* Define if LC_MESSAGES is available in <locale.h>. */
+#define _GLIBCXX_HAVE_LC_MESSAGES 1
+
+/* Define to 1 if you have the `ldexpf' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPF */
+
+/* Define to 1 if you have the `ldexpl' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPL */
+
+/* Define to 1 if you have the <libintl.h> header file. */
+/* #undef _GLIBCXX_HAVE_LIBINTL_H */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_AS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_DATA */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_FSIZE */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_RSS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_VMEM */
+
+/* Define if futex syscall is available. */
+/* #undef _GLIBCXX_HAVE_LINUX_FUTEX */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define _GLIBCXX_HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `log10f' function. */
+/* #undef _GLIBCXX_HAVE_LOG10F */
+
+/* Define to 1 if you have the `log10l' function. */
+/* #undef _GLIBCXX_HAVE_LOG10L */
+
+/* Define to 1 if you have the `logf' function. */
+/* #undef _GLIBCXX_HAVE_LOGF */
+
+/* Define to 1 if you have the `logl' function. */
+/* #undef _GLIBCXX_HAVE_LOGL */
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
+
+/* Define to 1 if you have the <machine/param.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
+
+/* Define if mbstate_t exists in wchar.h. */
+#define _GLIBCXX_HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _GLIBCXX_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `modf' function. */
+/* #undef _GLIBCXX_HAVE_MODF */
+
+/* Define to 1 if you have the `modff' function. */
+/* #undef _GLIBCXX_HAVE_MODFF */
+
+/* Define to 1 if you have the `modfl' function. */
+/* #undef _GLIBCXX_HAVE_MODFL */
+
+/* Define to 1 if you have the <nan.h> header file. */
+/* #undef _GLIBCXX_HAVE_NAN_H */
+
+/* Define if poll is available in <poll.h>. */
+/* #undef _GLIBCXX_HAVE_POLL */
+
+/* Define to 1 if you have the `powf' function. */
+/* #undef _GLIBCXX_HAVE_POWF */
+
+/* Define to 1 if you have the `powl' function. */
+/* #undef _GLIBCXX_HAVE_POWL */
+
+/* Define to 1 if you have the `qfpclass' function. */
+/* #undef _GLIBCXX_HAVE_QFPCLASS */
+
+/* Define to 1 if you have the `setenv' function. */
+/* #undef _GLIBCXX_HAVE_SETENV */
+
+/* Define to 1 if you have the `sincos' function. */
+/* #undef _GLIBCXX_HAVE_SINCOS */
+
+/* Define to 1 if you have the `sincosf' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSF */
+
+/* Define to 1 if you have the `sincosl' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSL */
+
+/* Define to 1 if you have the `sinf' function. */
+/* #undef _GLIBCXX_HAVE_SINF */
+
+/* Define to 1 if you have the `sinhf' function. */
+/* #undef _GLIBCXX_HAVE_SINHF */
+
+/* Define to 1 if you have the `sinhl' function. */
+/* #undef _GLIBCXX_HAVE_SINHL */
+
+/* Define to 1 if you have the `sinl' function. */
+/* #undef _GLIBCXX_HAVE_SINL */
+
+/* Define to 1 if you have the `sqrtf' function. */
+/* #undef _GLIBCXX_HAVE_SQRTF */
+
+/* Define to 1 if you have the `sqrtl' function. */
+/* #undef _GLIBCXX_HAVE_SQRTL */
+
+/* Define to 1 if you have the <stdbool.h> header file. */
+#define _GLIBCXX_HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _GLIBCXX_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _GLIBCXX_HAVE_STDLIB_H 1
+
+/* Define if strerror_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRERROR_L */
+
+/* Define if strerror_r is available in <string.h>. */
+#define _GLIBCXX_HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _GLIBCXX_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _GLIBCXX_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtof' function. */
+/* #undef _GLIBCXX_HAVE_STRTOF */
+
+/* Define to 1 if you have the `strtold' function. */
+/* #undef _GLIBCXX_HAVE_STRTOLD */
+
+/* Define if strxfrm_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRXFRM_L */
+
+/* Define to 1 if the target runtime linker supports binding the same symbol
+   to different versions. */
+/* #undef _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT */
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the <sys/isa_defs.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
+
+/* Define to 1 if you have the <sys/machine.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _GLIBCXX_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_SEM_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _GLIBCXX_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define _GLIBCXX_HAVE_SYS_UIO_H 1
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_IFREG */
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_ISREG */
+
+/* Define to 1 if you have the `tanf' function. */
+/* #undef _GLIBCXX_HAVE_TANF */
+
+/* Define to 1 if you have the `tanhf' function. */
+/* #undef _GLIBCXX_HAVE_TANHF */
+
+/* Define to 1 if you have the `tanhl' function. */
+/* #undef _GLIBCXX_HAVE_TANHL */
+
+/* Define to 1 if you have the `tanl' function. */
+/* #undef _GLIBCXX_HAVE_TANL */
+
+/* Define to 1 if you have the <tgmath.h> header file. */
+/* #undef _GLIBCXX_HAVE_TGMATH_H */
+
+/* Define to 1 if the target supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_TLS */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _GLIBCXX_HAVE_UNISTD_H 1
+
+/* Defined if vfwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VFWSCANF */
+
+/* Defined if vswscanf exists. */
+/* #undef _GLIBCXX_HAVE_VSWSCANF */
+
+/* Defined if vwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VWSCANF */
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define _GLIBCXX_HAVE_WCHAR_H 1
+
+/* Defined if wcstof exists. */
+/* #undef _GLIBCXX_HAVE_WCSTOF */
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define _GLIBCXX_HAVE_WCTYPE_H 1
+
+/* Define if writev is available in <sys/uio.h>. */
+/* #undef _GLIBCXX_HAVE_WRITEV */
+
+/* Define to 1 if you have the `_acosf' function. */
+/* #undef _GLIBCXX_HAVE__ACOSF */
+
+/* Define to 1 if you have the `_acosl' function. */
+/* #undef _GLIBCXX_HAVE__ACOSL */
+
+/* Define to 1 if you have the `_asinf' function. */
+/* #undef _GLIBCXX_HAVE__ASINF */
+
+/* Define to 1 if you have the `_asinl' function. */
+/* #undef _GLIBCXX_HAVE__ASINL */
+
+/* Define to 1 if you have the `_atan2f' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2F */
+
+/* Define to 1 if you have the `_atan2l' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2L */
+
+/* Define to 1 if you have the `_atanf' function. */
+/* #undef _GLIBCXX_HAVE__ATANF */
+
+/* Define to 1 if you have the `_atanl' function. */
+/* #undef _GLIBCXX_HAVE__ATANL */
+
+/* Define to 1 if you have the `_ceilf' function. */
+/* #undef _GLIBCXX_HAVE__CEILF */
+
+/* Define to 1 if you have the `_ceill' function. */
+/* #undef _GLIBCXX_HAVE__CEILL */
+
+/* Define to 1 if you have the `_cosf' function. */
+/* #undef _GLIBCXX_HAVE__COSF */
+
+/* Define to 1 if you have the `_coshf' function. */
+/* #undef _GLIBCXX_HAVE__COSHF */
+
+/* Define to 1 if you have the `_coshl' function. */
+/* #undef _GLIBCXX_HAVE__COSHL */
+
+/* Define to 1 if you have the `_cosl' function. */
+/* #undef _GLIBCXX_HAVE__COSL */
+
+/* Define to 1 if you have the `_expf' function. */
+/* #undef _GLIBCXX_HAVE__EXPF */
+
+/* Define to 1 if you have the `_expl' function. */
+/* #undef _GLIBCXX_HAVE__EXPL */
+
+/* Define to 1 if you have the `_fabsf' function. */
+/* #undef _GLIBCXX_HAVE__FABSF */
+
+/* Define to 1 if you have the `_fabsl' function. */
+/* #undef _GLIBCXX_HAVE__FABSL */
+
+/* Define to 1 if you have the `_finite' function. */
+/* #undef _GLIBCXX_HAVE__FINITE */
+
+/* Define to 1 if you have the `_finitef' function. */
+/* #undef _GLIBCXX_HAVE__FINITEF */
+
+/* Define to 1 if you have the `_finitel' function. */
+/* #undef _GLIBCXX_HAVE__FINITEL */
+
+/* Define to 1 if you have the `_floorf' function. */
+/* #undef _GLIBCXX_HAVE__FLOORF */
+
+/* Define to 1 if you have the `_floorl' function. */
+/* #undef _GLIBCXX_HAVE__FLOORL */
+
+/* Define to 1 if you have the `_fmodf' function. */
+/* #undef _GLIBCXX_HAVE__FMODF */
+
+/* Define to 1 if you have the `_fmodl' function. */
+/* #undef _GLIBCXX_HAVE__FMODL */
+
+/* Define to 1 if you have the `_fpclass' function. */
+/* #undef _GLIBCXX_HAVE__FPCLASS */
+
+/* Define to 1 if you have the `_frexpf' function. */
+/* #undef _GLIBCXX_HAVE__FREXPF */
+
+/* Define to 1 if you have the `_frexpl' function. */
+/* #undef _GLIBCXX_HAVE__FREXPL */
+
+/* Define to 1 if you have the `_hypot' function. */
+/* #undef _GLIBCXX_HAVE__HYPOT */
+
+/* Define to 1 if you have the `_hypotf' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTF */
+
+/* Define to 1 if you have the `_hypotl' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTL */
+
+/* Define to 1 if you have the `_isinf' function. */
+/* #undef _GLIBCXX_HAVE__ISINF */
+
+/* Define to 1 if you have the `_isinff' function. */
+/* #undef _GLIBCXX_HAVE__ISINFF */
+
+/* Define to 1 if you have the `_isinfl' function. */
+/* #undef _GLIBCXX_HAVE__ISINFL */
+
+/* Define to 1 if you have the `_isnan' function. */
+/* #undef _GLIBCXX_HAVE__ISNAN */
+
+/* Define to 1 if you have the `_isnanf' function. */
+/* #undef _GLIBCXX_HAVE__ISNANF */
+
+/* Define to 1 if you have the `_isnanl' function. */
+/* #undef _GLIBCXX_HAVE__ISNANL */
+
+/* Define to 1 if you have the `_ldexpf' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPF */
+
+/* Define to 1 if you have the `_ldexpl' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPL */
+
+/* Define to 1 if you have the `_log10f' function. */
+/* #undef _GLIBCXX_HAVE__LOG10F */
+
+/* Define to 1 if you have the `_log10l' function. */
+/* #undef _GLIBCXX_HAVE__LOG10L */
+
+/* Define to 1 if you have the `_logf' function. */
+/* #undef _GLIBCXX_HAVE__LOGF */
+
+/* Define to 1 if you have the `_logl' function. */
+/* #undef _GLIBCXX_HAVE__LOGL */
+
+/* Define to 1 if you have the `_modf' function. */
+/* #undef _GLIBCXX_HAVE__MODF */
+
+/* Define to 1 if you have the `_modff' function. */
+/* #undef _GLIBCXX_HAVE__MODFF */
+
+/* Define to 1 if you have the `_modfl' function. */
+/* #undef _GLIBCXX_HAVE__MODFL */
+
+/* Define to 1 if you have the `_powf' function. */
+/* #undef _GLIBCXX_HAVE__POWF */
+
+/* Define to 1 if you have the `_powl' function. */
+/* #undef _GLIBCXX_HAVE__POWL */
+
+/* Define to 1 if you have the `_qfpclass' function. */
+/* #undef _GLIBCXX_HAVE__QFPCLASS */
+
+/* Define to 1 if you have the `_sincos' function. */
+/* #undef _GLIBCXX_HAVE__SINCOS */
+
+/* Define to 1 if you have the `_sincosf' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSF */
+
+/* Define to 1 if you have the `_sincosl' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSL */
+
+/* Define to 1 if you have the `_sinf' function. */
+/* #undef _GLIBCXX_HAVE__SINF */
+
+/* Define to 1 if you have the `_sinhf' function. */
+/* #undef _GLIBCXX_HAVE__SINHF */
+
+/* Define to 1 if you have the `_sinhl' function. */
+/* #undef _GLIBCXX_HAVE__SINHL */
+
+/* Define to 1 if you have the `_sinl' function. */
+/* #undef _GLIBCXX_HAVE__SINL */
+
+/* Define to 1 if you have the `_sqrtf' function. */
+/* #undef _GLIBCXX_HAVE__SQRTF */
+
+/* Define to 1 if you have the `_sqrtl' function. */
+/* #undef _GLIBCXX_HAVE__SQRTL */
+
+/* Define to 1 if you have the `_tanf' function. */
+/* #undef _GLIBCXX_HAVE__TANF */
+
+/* Define to 1 if you have the `_tanhf' function. */
+/* #undef _GLIBCXX_HAVE__TANHF */
+
+/* Define to 1 if you have the `_tanhl' function. */
+/* #undef _GLIBCXX_HAVE__TANHL */
+
+/* Define to 1 if you have the `_tanl' function. */
+/* #undef _GLIBCXX_HAVE__TANL */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef _GLIBCXX_ICONV_CONST */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+/* #undef _GLIBCXX_PACKAGE */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _GLIBCXX_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _GLIBCXX_PACKAGE_NAME "package-unused"
+
+/* Define to the full name and version of this package. */
+#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
+
+/* Define to the one symbol short name of this package. */
+#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
+
+/* Define to the home page for this package. */
+#define _GLIBCXX_PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void *', as computed by sizeof. */
+/* #undef SIZEOF_VOID_P */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+/* #undef _GLIBCXX_VERSION */
+
+/* Define if builtin atomic operations for bool are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+
+/* Define if builtin atomic operations for short are supported on this host.
+   */
+#define _GLIBCXX_ATOMIC_BUILTINS_2 1
+
+/* Define if builtin atomic operations for int are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_4 1
+
+/* Define if builtin atomic operations for long long are supported on this
+   host. */
+/* #undef _GLIBCXX_ATOMIC_BUILTINS_8 */
+
+/* Define to use concept checking code from the boost libraries. */
+/* #undef _GLIBCXX_CONCEPT_CHECKS */
+
+/* Define if a fully dynamic basic_string is wanted. */
+/* #undef _GLIBCXX_FULLY_DYNAMIC_STRING */
+
+/* Define if gthreads library is available. */
+/* #undef _GLIBCXX_HAS_GTHREADS */
+
+/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
+#define _GLIBCXX_HOSTED 1
+
+/* Define if compatibility should be provided for -mlong-double-64. */
+
+/* Define if ptrdiff_t is int. */
+#define _GLIBCXX_PTRDIFF_T_IS_INT 1
+
+/* Define if using setrlimit to set resource limits during "make check" */
+/* #undef _GLIBCXX_RES_LIMITS */
+
+/* Define if size_t is unsigned int. */
+#define _GLIBCXX_SIZE_T_IS_UINT 1
+
+/* Define if the compiler is configured for setjmp/longjmp exceptions. */
+/* #undef _GLIBCXX_SJLJ_EXCEPTIONS */
+
+/* Define to the value of the EOF integer constant. */
+#define _GLIBCXX_STDIO_EOF -1
+
+/* Define to the value of the SEEK_CUR integer constant. */
+#define _GLIBCXX_STDIO_SEEK_CUR 1
+
+/* Define to the value of the SEEK_END integer constant. */
+#define _GLIBCXX_STDIO_SEEK_END 2
+
+/* Define to use symbol versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER */
+
+/* Define to use darwin versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_DARWIN */
+
+/* Define to use GNU versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU */
+
+/* Define to use GNU namespace versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
+
+/* Define to use Sun versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_SUN */
+
+/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
+   <stdio.h>, and <stdlib.h> can be used or exposed. */
+/* #undef _GLIBCXX_USE_C99 */
+
+/* Define if C99 functions in <complex.h> should be used in <complex>. Using
+   compiler builtins for these functions requires corresponding C99 library
+   functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX */
+
+/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
+   Using compiler builtins for these functions requires corresponding C99
+   library functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX_TR1 */
+
+/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_CTYPE_TR1 1
+
+/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_FENV_TR1 1
+
+/* Define if C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
+
+/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 */
+
+/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
+   in namespace std. */
+/* #undef _GLIBCXX_USE_C99_MATH */
+
+/* Define if C99 functions or macros in <math.h> should be imported in
+   <tr1/cmath> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_MATH_TR1 */
+
+/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_STDINT_TR1 1
+
+/* Defined if clock_gettime has monotonic clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_MONOTONIC */
+
+/* Defined if clock_gettime has realtime clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_REALTIME */
+
+/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
+   this host. */
+/* #undef _GLIBCXX_USE_DECIMAL_FLOAT */
+
+/* Defined if gettimeofday is available. */
+/* #undef _GLIBCXX_USE_GETTIMEOFDAY */
+
+/* Define if LFS support is available. */
+/* #undef _GLIBCXX_USE_LFS */
+
+/* Define if code specialized for long long should be used. */
+#define _GLIBCXX_USE_LONG_LONG 1
+
+/* Defined if nanosleep is available. */
+/* #undef _GLIBCXX_USE_NANOSLEEP */
+
+/* Define if NLS translations are to be used. */
+/* #undef _GLIBCXX_USE_NLS */
+
+/* Define if /dev/random and /dev/urandom are available for the random_device
+   of TR1 (Chapter 5.1). */
+#define _GLIBCXX_USE_RANDOM_TR1 1
+
+/* Defined if sched_yield is available. */
+/* #undef _GLIBCXX_USE_SCHED_YIELD */
+
+/* Define if code specialized for wchar_t should be used. */
+#define _GLIBCXX_USE_WCHAR_T 1
+
+#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
+# define _GLIBCXX_HAVE_ACOSF 1
+# define acosf _acosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
+# define _GLIBCXX_HAVE_ACOSL 1
+# define acosl _acosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
+# define _GLIBCXX_HAVE_ASINF 1
+# define asinf _asinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
+# define _GLIBCXX_HAVE_ASINL 1
+# define asinl _asinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
+# define _GLIBCXX_HAVE_ATAN2F 1
+# define atan2f _atan2f
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
+# define _GLIBCXX_HAVE_ATAN2L 1
+# define atan2l _atan2l
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
+# define _GLIBCXX_HAVE_ATANF 1
+# define atanf _atanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
+# define _GLIBCXX_HAVE_ATANL 1
+# define atanl _atanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
+# define _GLIBCXX_HAVE_CEILF 1
+# define ceilf _ceilf
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
+# define _GLIBCXX_HAVE_CEILL 1
+# define ceill _ceill
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
+# define _GLIBCXX_HAVE_COSF 1
+# define cosf _cosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
+# define _GLIBCXX_HAVE_COSHF 1
+# define coshf _coshf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
+# define _GLIBCXX_HAVE_COSHL 1
+# define coshl _coshl
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
+# define _GLIBCXX_HAVE_COSL 1
+# define cosl _cosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
+# define _GLIBCXX_HAVE_EXPF 1
+# define expf _expf
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
+# define _GLIBCXX_HAVE_EXPL 1
+# define expl _expl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
+# define _GLIBCXX_HAVE_FABSF 1
+# define fabsf _fabsf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
+# define _GLIBCXX_HAVE_FABSL 1
+# define fabsl _fabsl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
+# define _GLIBCXX_HAVE_FINITE 1
+# define finite _finite
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
+# define _GLIBCXX_HAVE_FINITEF 1
+# define finitef _finitef
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
+# define _GLIBCXX_HAVE_FINITEL 1
+# define finitel _finitel
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
+# define _GLIBCXX_HAVE_FLOORF 1
+# define floorf _floorf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
+# define _GLIBCXX_HAVE_FLOORL 1
+# define floorl _floorl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
+# define _GLIBCXX_HAVE_FMODF 1
+# define fmodf _fmodf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
+# define _GLIBCXX_HAVE_FMODL 1
+# define fmodl _fmodl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
+# define _GLIBCXX_HAVE_FPCLASS 1
+# define fpclass _fpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
+# define _GLIBCXX_HAVE_FREXPF 1
+# define frexpf _frexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
+# define _GLIBCXX_HAVE_FREXPL 1
+# define frexpl _frexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
+# define _GLIBCXX_HAVE_HYPOT 1
+# define hypot _hypot
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
+# define _GLIBCXX_HAVE_HYPOTF 1
+# define hypotf _hypotf
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
+# define _GLIBCXX_HAVE_HYPOTL 1
+# define hypotl _hypotl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
+# define _GLIBCXX_HAVE_ISINF 1
+# define isinf _isinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
+# define _GLIBCXX_HAVE_ISINFF 1
+# define isinff _isinff
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
+# define _GLIBCXX_HAVE_ISINFL 1
+# define isinfl _isinfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
+# define _GLIBCXX_HAVE_ISNAN 1
+# define isnan _isnan
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
+# define _GLIBCXX_HAVE_ISNANF 1
+# define isnanf _isnanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
+# define _GLIBCXX_HAVE_ISNANL 1
+# define isnanl _isnanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
+# define _GLIBCXX_HAVE_LDEXPF 1
+# define ldexpf _ldexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
+# define _GLIBCXX_HAVE_LDEXPL 1
+# define ldexpl _ldexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
+# define _GLIBCXX_HAVE_LOG10F 1
+# define log10f _log10f
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
+# define _GLIBCXX_HAVE_LOG10L 1
+# define log10l _log10l
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
+# define _GLIBCXX_HAVE_LOGF 1
+# define logf _logf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
+# define _GLIBCXX_HAVE_LOGL 1
+# define logl _logl
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
+# define _GLIBCXX_HAVE_MODF 1
+# define modf _modf
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
+# define _GLIBCXX_HAVE_MODFF 1
+# define modff _modff
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
+# define _GLIBCXX_HAVE_MODFL 1
+# define modfl _modfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
+# define _GLIBCXX_HAVE_POWF 1
+# define powf _powf
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
+# define _GLIBCXX_HAVE_POWL 1
+# define powl _powl
+#endif
+
+#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
+# define _GLIBCXX_HAVE_QFPCLASS 1
+# define qfpclass _qfpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
+# define _GLIBCXX_HAVE_SINCOS 1
+# define sincos _sincos
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
+# define _GLIBCXX_HAVE_SINCOSF 1
+# define sincosf _sincosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
+# define _GLIBCXX_HAVE_SINCOSL 1
+# define sincosl _sincosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
+# define _GLIBCXX_HAVE_SINF 1
+# define sinf _sinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
+# define _GLIBCXX_HAVE_SINHF 1
+# define sinhf _sinhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
+# define _GLIBCXX_HAVE_SINHL 1
+# define sinhl _sinhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
+# define _GLIBCXX_HAVE_SINL 1
+# define sinl _sinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
+# define _GLIBCXX_HAVE_SQRTF 1
+# define sqrtf _sqrtf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
+# define _GLIBCXX_HAVE_SQRTL 1
+# define sqrtl _sqrtl
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
+# define _GLIBCXX_HAVE_STRTOF 1
+# define strtof _strtof
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
+# define _GLIBCXX_HAVE_STRTOLD 1
+# define strtold _strtold
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
+# define _GLIBCXX_HAVE_TANF 1
+# define tanf _tanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
+# define _GLIBCXX_HAVE_TANHF 1
+# define tanhf _tanhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
+# define _GLIBCXX_HAVE_TANHL 1
+# define tanhl _tanhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
+# define _GLIBCXX_HAVE_TANL 1
+# define tanl _tanl
+#endif
+
+#endif // _GLIBCXX_CXX_CONFIG_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++io.h
@@ -0,0 +1,51 @@
+// Underlying io library details -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++io.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+// c_io_stdio.h - Defines for using "C" stdio.h
+
+#ifndef _GLIBCXX_CXX_IO_H
+#define _GLIBCXX_CXX_IO_H 1
+
+#include <cstdio>
+#include <bits/gthr.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef __gthread_mutex_t __c_lock;
+
+  // for basic_file.h
+  typedef FILE __c_file;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++locale.h
@@ -0,0 +1,93 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++locale.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#ifndef _GLIBCXX_CXX_LOCALE_H
+#define _GLIBCXX_CXX_LOCALE_H 1
+
+#pragma GCC system_header
+
+#include <clocale>
+
+#define _GLIBCXX_NUM_CATEGORIES 0
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef int*			__c_locale;
+
+  // Convert numeric value of type double and long double to string and
+  // return length of string.  If vsnprintf is available use it, otherwise
+  // fall back to the unsafe vsprintf which, in general, can be dangerous
+  // and should be avoided.
+  inline int
+  __convert_from_v(const __c_locale&, char* __out, 
+		   const int __size __attribute__((__unused__)),
+		   const char* __fmt, ...)
+  {
+    char* __old = std::setlocale(LC_NUMERIC, 0);
+    char* __sav = 0;
+    if (__old && __builtin_strcmp(__old, "C"))
+      {
+	const size_t __len = __builtin_strlen(__old) + 1;
+	__sav = new char[__len];
+	__builtin_memcpy(__sav, __old, __len);
+	std::setlocale(LC_NUMERIC, "C");
+      }
+
+    __builtin_va_list __args;
+    __builtin_va_start(__args, __fmt);
+
+#ifdef _GLIBCXX_USE_C99
+    const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
+#else
+    const int __ret = __builtin_vsprintf(__out, __fmt, __args);
+#endif
+
+    __builtin_va_end(__args);
+
+    if (__sav)
+      {
+	std::setlocale(LC_NUMERIC, __sav);
+	delete [] __sav;
+      }
+    return __ret;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cpu_defines.h
@@ -0,0 +1,33 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cpu_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_base.h
@@ -0,0 +1,60 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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
+//
+
+// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
+
+// Support for Solaris 2.5.1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int* 		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef char 		mask;
+    static const mask upper    	= _U;
+    static const mask lower 	= _L;
+    static const mask alpha 	= _U | _L;
+    static const mask digit 	= _N;
+    static const mask xdigit 	= _X | _N;
+    static const mask space 	= _S;
+    static const mask print 	= _P | _U | _L | _N | _B;
+    static const mask graph 	= _P | _U | _L | _N;
+    static const mask cntrl 	= _C;
+    static const mask punct 	= _P;
+    static const mask alnum 	= _U | _L | _N;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_inline.h
@@ -0,0 +1,74 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    while (__low < __high)
+      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && !this->is(__m, *__low))
+      ++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && this->is(__m, *__low) != 0)
+      ++__low;
+    return __low;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_noninline.h
@@ -0,0 +1,98 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_noninline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return _ctype_ + 1; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+		     size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x);
+  }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_toupper(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
+  }
+
+  const char*
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_tolower(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..2ac349d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cxxabi_tweaks.h
@@ -0,0 +1,82 @@
+// Control various target specific ABI tweaks.  ARM version.
+
+// Copyright (C) 2004, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cxxabi_tweaks.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{cxxabi.h}
+ */
+
+#ifndef _CXXABI_TWEAKS_H
+#define _CXXABI_TWEAKS_H 1
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{
+  extern "C" 
+  {
+#endif
+
+#ifdef __ARM_EABI__
+  // The ARM EABI uses the least significant bit of a 32-bit
+  // guard variable.  */
+#define _GLIBCXX_GUARD_TEST(x) ((*(x) & 1) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(x) = 1
+#define _GLIBCXX_GUARD_BIT 1
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
+  typedef int __guard;
+
+  // We also want the element size in array cookies.
+#define _GLIBCXX_ELTSIZE_IN_COOKIE 1
+  
+  // __cxa_vec_ctor should return a pointer to the array.
+  typedef void * __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return x
+  // Constructors and destructors return the "this" pointer.
+  typedef void * __cxa_cdtor_return_type;
+
+#else // __ARM_EABI__
+
+  // The generic ABI uses the first byte of a 64-bit guard variable.
+#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
+#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
+  __extension__ typedef int __guard __attribute__((mode (__DI__)));
+
+  // __cxa_vec_ctor has void return type.
+  typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+  // Constructors and destructors do not return a value.
+  typedef void __cxa_cdtor_return_type;
+
+#endif //!__ARM_EABI__
+
+#ifdef __cplusplus
+  }
+} // namespace __cxxabiv1
+#endif
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/error_constants.h
@@ -0,0 +1,178 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/error_constants.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{system_error}
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#define _GLIBCXX_ERROR_CONSTANTS 1
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  enum class errc
+    {
+      address_family_not_supported = 		EAFNOSUPPORT,
+      address_in_use = 				EADDRINUSE,
+      address_not_available = 			EADDRNOTAVAIL,
+      already_connected = 			EISCONN,
+      argument_list_too_long = 			E2BIG,
+      argument_out_of_domain = 			EDOM,
+      bad_address = 				EFAULT,
+      bad_file_descriptor = 			EBADF,
+
+#ifdef _GLIBCXX_HAVE_EBADMSG
+      bad_message = 				EBADMSG,
+#endif
+
+      broken_pipe = 				EPIPE,
+      connection_aborted = 			ECONNABORTED,
+      connection_already_in_progress = 		EALREADY,
+      connection_refused = 			ECONNREFUSED,
+      connection_reset = 			ECONNRESET,
+      cross_device_link = 			EXDEV,
+      destination_address_required = 		EDESTADDRREQ,
+      device_or_resource_busy = 		EBUSY,
+      directory_not_empty = 			ENOTEMPTY,
+      executable_format_error = 		ENOEXEC,
+      file_exists = 	       			EEXIST,
+      file_too_large = 				EFBIG,
+      filename_too_long = 			ENAMETOOLONG,
+      function_not_supported = 			ENOSYS,
+      host_unreachable = 			EHOSTUNREACH,
+
+#ifdef _GLIBCXX_HAVE_EIDRM
+      identifier_removed = 			EIDRM,
+#endif
+
+      illegal_byte_sequence = 			EILSEQ,
+      inappropriate_io_control_operation = 	ENOTTY,
+      interrupted = 				EINTR,
+      invalid_argument = 			EINVAL,
+      invalid_seek = 				ESPIPE,
+      io_error = 				EIO,
+      is_a_directory = 				EISDIR,
+      message_size = 				EMSGSIZE,
+      network_down = 				ENETDOWN,
+      network_reset = 				ENETRESET,
+      network_unreachable = 			ENETUNREACH,
+      no_buffer_space = 			ENOBUFS,
+      no_child_process = 			ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+      no_link = 				ENOLINK,
+#endif
+
+      no_lock_available = 			ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+      no_message_available = 			ENODATA, 
+#endif
+
+      no_message = 				ENOMSG, 
+      no_protocol_option = 			ENOPROTOOPT,
+      no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+      no_stream_resources = 			ENOSR,
+#endif
+
+      no_such_device_or_address = 		ENXIO,
+      no_such_device = 				ENODEV,
+      no_such_file_or_directory = 		ENOENT,
+      no_such_process = 			ESRCH,
+      not_a_directory = 			ENOTDIR,
+      not_a_socket = 				ENOTSOCK,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+      not_a_stream = 				ENOSTR,
+#endif
+
+      not_connected = 				ENOTCONN,
+      not_enough_memory = 			ENOMEM,
+
+#ifdef _GLIBCXX_HAVE_ENOTSUP
+      not_supported = 				ENOTSUP,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ECANCELED
+      operation_canceled = 			ECANCELED,
+#endif
+
+      operation_in_progress = 			EINPROGRESS,
+      operation_not_permitted = 		EPERM,
+      operation_not_supported = 		EOPNOTSUPP,
+      operation_would_block = 			EWOULDBLOCK,
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead = 				EOWNERDEAD,
+#endif
+
+      permission_denied = 			EACCES,
+
+#ifdef _GLIBCXX_HAVE_EPROTO
+      protocol_error = 				EPROTO,
+#endif
+
+      protocol_not_supported = 			EPROTONOSUPPORT,
+      read_only_file_system = 			EROFS,
+      resource_deadlock_would_occur = 		EDEADLK,
+      resource_unavailable_try_again = 		EAGAIN,
+      result_out_of_range = 			ERANGE,
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+      stream_timeout = 				ETIME,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETXTBSY
+      text_file_busy = 				ETXTBSY,
+#endif
+
+      timed_out = 				ETIMEDOUT,
+      too_many_files_open_in_system = 		ENFILE,
+      too_many_files_open = 			EMFILE,
+      too_many_links = 				EMLINK,
+      too_many_symbolic_link_levels = 		ELOOP,
+
+#ifdef _GLIBCXX_HAVE_EOVERFLOW
+      value_too_large = 			EOVERFLOW,
+#endif
+
+      wrong_protocol_type = 			EPROTOTYPE
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/extc++.h
@@ -0,0 +1,71 @@
+// 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.
+ */
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/stdtr1c++.h>
+#endif
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-default.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-default.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-posix.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-single.h
@@ -0,0 +1,292 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_SINGLE_H
+#define _GLIBCXX_GCC_GTHR_SINGLE_H
+
+/* Just provide compatibility for mutex handling.  */
+
+typedef int __gthread_key_t;
+typedef int __gthread_once_t;
+typedef int __gthread_mutex_t;
+typedef int __gthread_recursive_mutex_t;
+
+#define __GTHREAD_ONCE_INIT 0
+#define __GTHREAD_MUTEX_INIT 0
+#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
+
+#define _GLIBCXX_UNUSED __attribute__((unused))
+
+#ifdef _LIBOBJC
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return NULL;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+  return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  return;
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  /* No thread support available */
+  /* Should we really exit the program */
+  /* exit (&__objc_thread_exit_status); */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  /* No thread support, use 1.  */
+  return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  thread_local_storage = value;
+  return 0;
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
+			       objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 0;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int _GLIBCXX_UNUSED
+__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static int _GLIBCXX_UNUSED
+__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+#endif /* _LIBOBJC */
+
+#undef _GLIBCXX_UNUSED
+
+#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-tpf.h
@@ -0,0 +1,229 @@
+/* Threads compatibility routines for libgcc2 and libobjc.
+   Compile this one with gcc.
+   Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* TPF needs its own version of gthr-*.h because TPF always links to
+   the thread library.  However, for performance reasons we still do not
+   want to issue thread api calls unless a check is made to see that we
+   are running as a thread.  */
+
+#ifndef _GLIBCXX_GCC_GTHR_TPF_H
+#define _GLIBCXX_GCC_GTHR_TPF_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#endif
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+
+#define NOTATHREAD   00
+#define ECBBASEPTR (unsigned long int) *(unsigned int *)0x00000514u
+#define ECBPG2PTR  ECBBASEPTR + 0x1000
+#define CE2THRCPTR *((unsigned char *)(ECBPG2PTR + 16))
+#define __tpf_pthread_active() (CE2THRCPTR != NOTATHREAD)
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# define __gthrw(name) \
+  static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw(name)
+# define __gthrw_(name) name
+#endif
+
+__gthrw(pthread_once)
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+__gthrw(pthread_create)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_create) (__key, __dtor);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_delete) (__key);
+  else
+    return -1;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_getspecific) (__key);
+  else
+    return NULL;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_setspecific) (__key, __ptr);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_lock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_trylock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_unlock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+
+
+#endif /* ! _GLIBCXX_GCC_GTHR_TPF_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr.h
@@ -0,0 +1,173 @@
+/* Threads compatibility routines for libgcc2.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_H
+#define _GLIBCXX_GCC_GTHR_H
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility push(default)
+#endif
+
+/* If this file is compiled with threads support, it must
+       #define __GTHREADS 1
+   to indicate that threads support is present.  Also it has define
+   function
+     int __gthread_active_p ()
+   that returns 1 if thread system is active, 0 if not.
+
+   The threads interface must define the following types:
+     __gthread_key_t
+     __gthread_once_t
+     __gthread_mutex_t
+     __gthread_recursive_mutex_t
+
+   The threads interface must define the following macros:
+
+     __GTHREAD_ONCE_INIT
+     		to initialize __gthread_once_t
+     __GTHREAD_MUTEX_INIT
+     		to initialize __gthread_mutex_t to get a fast
+		non-recursive mutex.
+     __GTHREAD_MUTEX_INIT_FUNCTION
+     		some systems can't initialize a mutex without a
+		function call.  On such systems, define this to a
+		function which looks like this:
+		  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
+		Don't define __GTHREAD_MUTEX_INIT in this case
+     __GTHREAD_RECURSIVE_MUTEX_INIT
+     __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
+     		as above, but for a recursive mutex.
+
+   The threads interface must define the following static functions:
+
+     int __gthread_once (__gthread_once_t *once, void (*func) ())
+
+     int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
+     int __gthread_key_delete (__gthread_key_t key)
+
+     void *__gthread_getspecific (__gthread_key_t key)
+     int __gthread_setspecific (__gthread_key_t key, const void *ptr)
+
+     int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
+
+     int __gthread_mutex_lock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
+
+     int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
+
+   The following are supported in POSIX threads only. They are required to
+   fix a deadlock in static initialization inside libsupc++. The header file
+   gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
+   features are supported.
+
+   Types:
+     __gthread_cond_t
+
+   Macros:
+     __GTHREAD_COND_INIT
+     __GTHREAD_COND_INIT_FUNCTION
+
+   Interface:
+     int __gthread_cond_broadcast (__gthread_cond_t *cond);
+     int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
+     int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
+					__gthread_recursive_mutex_t *mutex);
+
+   All functions returning int should return zero on success or the error
+   number.  If the operation is not supported, -1 is returned.
+
+   If the following are also defined, you should
+     #define __GTHREADS_CXX0X 1
+   to enable the c++0x thread library.
+
+   Types:
+     __gthread_t
+     __gthread_time_t
+
+   Interface:
+     int __gthread_create (__gthread_t *thread, void *(*func) (void*),
+                           void *args);
+     int __gthread_join (__gthread_t thread, void **value_ptr);
+     int __gthread_detach (__gthread_t thread);
+     int __gthread_equal (__gthread_t t1, __gthread_t t2);
+     __gthread_t __gthread_self (void);
+     int __gthread_yield (void);
+
+     int __gthread_mutex_timedlock (__gthread_mutex_t *m,
+                                    const __gthread_time_t *abs_timeout);
+     int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
+                                          const __gthread_time_t *abs_time);
+
+     int __gthread_cond_signal (__gthread_cond_t *cond);
+     int __gthread_cond_timedwait (__gthread_cond_t *cond,
+                                   __gthread_mutex_t *mutex,
+                                   const __gthread_time_t *abs_timeout);
+     int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond,
+                                             __gthread_recursive_mutex_t *mutex,
+                                             const __gthread_time_t *abs_time)
+
+   Currently supported threads packages are
+     TPF threads with -D__tpf__
+     POSIX/Unix98 threads with -D_PTHREADS
+     POSIX/Unix95 threads with -D_PTHREADS95
+     DCE threads with -D_DCE_THREADS
+     Solaris/UI threads with -D_SOLARIS_THREADS
+
+*/
+
+/* Check first for thread specific defines.  */
+#if defined (_GLIBCXX___tpf_GLIBCXX___)
+#include <bits/gthr-tpf.h>
+#elif _GLIBCXX__PTHREADS
+#include <bits/gthr-posix.h>
+#elif _GLIBCXX__PTHREADS95
+#include <bits/gthr-posix95.h>
+#elif _GLIBCXX__DCE_THREADS
+#include <bits/gthr-dce.h>
+#elif _GLIBCXX__SOLARIS_THREADS
+#include <bits/gthr-solaris.h>
+
+/* Include GTHREAD_FILE if one is defined.  */
+#elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
+#if __GXX_WEAK__
+#ifndef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 1
+#endif
+#endif
+#include <bits/gthr-default.h>
+
+/* Fallback to single thread definitions.  */
+#else
+#include <bits/gthr-single.h>
+#endif
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility pop
+#endif
+
+#endif /* ! _GLIBCXX_GCC_GTHR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/messages_members.h
@@ -0,0 +1,93 @@
+// std::messages implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/messages_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Non-virtual member functions.
+  template<typename _CharT>
+     messages<_CharT>::messages(size_t __refs)
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+     messages<_CharT>::messages(__c_locale, const char*, size_t __refs) 
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
+			   const char*) const
+    { return this->do_open(__s, __loc); }
+
+  // Virtual member functions.
+  template<typename _CharT>
+    messages<_CharT>::~messages()
+    { _S_destroy_c_locale(_M_c_locale_messages); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
+    { return 0; }
+
+  template<typename _CharT>
+    typename messages<_CharT>::string_type  
+    messages<_CharT>::do_get(catalog, int, int, 
+			     const string_type& __dfault) const
+    { return __dfault; }
+
+  template<typename _CharT>
+    void    
+    messages<_CharT>::do_close(catalog) const 
+    { }
+
+   // messages_byname
+   template<typename _CharT>
+     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
+     : messages<_CharT>(__refs) 
+     { 
+	if (__builtin_strcmp(__s, "C") != 0
+	    && __builtin_strcmp(__s, "POSIX") != 0)
+	  {
+	    this->_S_destroy_c_locale(this->_M_c_locale_messages);
+	    this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
+	  }
+     }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/os_defines.h
@@ -0,0 +1,36 @@
+// Specific definitions for Bionic  -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/os_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdc++.h
@@ -0,0 +1,116 @@
+// C++ includes used for precompiling -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+#ifndef _GLIBCXX_NO_ASSERT
+#include <cassert>
+#endif
+#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 <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 <atomic>
+#include <chrono>
+#include <condition_variable>
+#include <forward_list>
+#include <future>
+#include <initializer_list>
+#include <mutex>
+#include <random>
+#include <ratio>
+#include <regex>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <typeindex>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdtr1c++.h
similarity index 100%
copy from 8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h
copy to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/time_members.h
@@ -0,0 +1,94 @@
+// std::time_get, std::time_put implementation, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/time_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(size_t __refs) 
+    : facet(__refs), _M_data(0)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
+    : facet(__refs), _M_data(__cache)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, 
+				     size_t __refs) 
+    : facet(__refs), _M_data(0)
+    {
+      if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
+	{
+	  const size_t __len = __builtin_strlen(__s) + 1;
+	  char* __tmp = new char[__len];
+	  __builtin_memcpy(__tmp, __s, __len);
+	  _M_name_timepunct = __tmp;
+	}
+      else
+	_M_name_timepunct = _S_get_c_name();
+
+      __try
+	{ _M_initialize_timepunct(__cloc); }
+      __catch(...)
+	{
+	  if (_M_name_timepunct != _S_get_c_name())
+	    delete [] _M_name_timepunct;
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::~__timepunct()
+    { 
+      if (_M_name_timepunct != _S_get_c_name())
+	delete [] _M_name_timepunct;
+      delete _M_data;
+      _S_destroy_c_locale(_M_c_locale_timepunct); 
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_shared.so
new file mode 100755
index 0000000..2b3ff47
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a
new file mode 100644
index 0000000..44849c8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a
new file mode 100644
index 0000000..43eed27
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/atomic_word.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/basic_file.h
@@ -0,0 +1,111 @@
+// Wrapper of C-language FILE struct -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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  File-based streams
+//
+
+/** @file bits/basic_file.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
+#define _GLIBCXX_BASIC_FILE_STDIO_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/c++io.h>  // for __c_lock and __c_file
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Generic declaration.
+  template<typename _CharT>
+    class __basic_file; 
+
+  // Specialization.
+  template<>
+    class __basic_file<char>
+    {
+      // Underlying data source/sink.
+      __c_file* 	_M_cfile;
+
+      // True iff we opened _M_cfile, and thus must close it ourselves.
+      bool 		_M_cfile_created;
+
+    public:
+      __basic_file(__c_lock* __lock = 0) throw ();
+
+      __basic_file* 
+      open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
+
+      __basic_file*
+      sys_open(__c_file* __file, ios_base::openmode);
+
+      __basic_file*
+      sys_open(int __fd, ios_base::openmode __mode) throw ();
+
+      __basic_file* 
+      close(); 
+
+      _GLIBCXX_PURE bool 
+      is_open() const throw ();
+
+      _GLIBCXX_PURE int 
+      fd() throw ();
+
+      _GLIBCXX_PURE __c_file*
+      file() throw ();
+
+      ~__basic_file();
+
+      streamsize 
+      xsputn(const char* __s, streamsize __n);
+
+      streamsize 
+      xsputn_2(const char* __s1, streamsize __n1,
+	       const char* __s2, streamsize __n2);
+
+      streamsize 
+      xsgetn(char* __s, streamsize __n);
+
+      streamoff
+      seekoff(streamoff __off, ios_base::seekdir __way) throw ();
+
+      int 
+      sync();
+
+      streamsize
+      showmanyc();
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif	
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++allocator.h
@@ -0,0 +1,37 @@
+// Base to std::allocator -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++allocator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _GLIBCXX_CXX_ALLOCATOR_H
+#define _GLIBCXX_CXX_ALLOCATOR_H 1
+
+// Define new_allocator as the base class to std::allocator.
+#include <ext/new_allocator.h>
+#define __glibcxx_base_allocator  __gnu_cxx::new_allocator
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++config.h
new file mode 100644
index 0000000..f087e98
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++config.h
@@ -0,0 +1,1569 @@
+// Predefined symbols and macros -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++config.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#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__ 20120106
+
+// Macros for various attributes.
+//   _GLIBCXX_PURE
+//   _GLIBCXX_CONST
+//   _GLIBCXX_NORETURN
+//   _GLIBCXX_NOTHROW
+//   _GLIBCXX_VISIBILITY
+#ifndef _GLIBCXX_PURE
+# define _GLIBCXX_PURE __attribute__ ((__pure__))
+#endif
+
+#ifndef _GLIBCXX_CONST
+# define _GLIBCXX_CONST __attribute__ ((__const__))
+#endif
+
+#ifndef _GLIBCXX_NORETURN
+# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+#ifndef _GLIBCXX_NOTHROW
+# ifdef __cplusplus
+#  define _GLIBCXX_NOTHROW throw()
+# else
+#  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
+# endif
+#endif
+
+// Macros for visibility attributes.
+//   _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+//   _GLIBCXX_VISIBILITY
+# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
+
+#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
+#else
+// If this is not supplied by the OS-specific or CPU-specific
+// headers included below, it will be defined to an empty default.
+# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
+#endif
+
+// Macros for deprecated attributes.
+//   _GLIBCXX_USE_DEPRECATED
+//   _GLIBCXX_DEPRECATED
+#ifndef _GLIBCXX_USE_DEPRECATED
+# define _GLIBCXX_USE_DEPRECATED 1
+#endif
+
+#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
+#else
+# define _GLIBCXX_DEPRECATED
+#endif
+
+#if __cplusplus
+
+// Macro for constexpr, to support in mixed 03/0x mode.
+#ifndef _GLIBCXX_CONSTEXPR
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+#  define _GLIBCXX_CONSTEXPR constexpr
+#  define _GLIBCXX_USE_CONSTEXPR constexpr
+# else
+#  define _GLIBCXX_CONSTEXPR
+#  define _GLIBCXX_USE_CONSTEXPR const
+# endif
+#endif
+
+// Macro for extern template, ie controling template linkage via use
+// of extern keyword on template declaration. As documented in the g++
+// manual, 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.
+// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
+// templates only in basic_string, thus activating its debug-mode
+// checks even at -O0.
+# define _GLIBCXX_EXTERN_TEMPLATE 1
+
+/*
+  Outline of libstdc++ namespaces.
+
+  namespace std
+  {
+    namespace __debug { }
+    namespace __parallel { }
+    namespace __profile { }
+    namespace __cxx1998 { }
+
+    namespace __detail { }
+
+    namespace rel_ops { }
+
+    namespace tr1
+    {
+      namespace placeholders { }
+      namespace regex_constants { }
+      namespace __detail { }
+    }
+
+    namespace decimal { }
+
+    namespace chrono { }
+    namespace placeholders { }
+    namespace regex_constants { }
+    namespace this_thread { }
+  }
+
+  namespace abi { }
+
+  namespace __gnu_cxx
+  {
+    namespace __detail { }
+  }
+
+  For full details see:
+  http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
+*/
+namespace std
+{
+  typedef __SIZE_TYPE__ 	size_t;
+  typedef __PTRDIFF_TYPE__	ptrdiff_t;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  typedef decltype(nullptr)	nullptr_t;
+#endif
+}
+
+
+// Defined if inline namespaces are used for versioning.
+# define _GLIBCXX_INLINE_VERSION 0 
+
+// Inline namespace for symbol versioning.
+#if _GLIBCXX_INLINE_VERSION
+
+namespace std
+{
+  inline namespace __7 { }
+
+  namespace rel_ops { inline namespace __7 { } }
+
+  namespace tr1
+  {
+    inline namespace __7 { }
+    namespace placeholders { inline namespace __7 { } }
+    namespace regex_constants { inline namespace __7 { } }
+    namespace __detail { inline namespace __7 { } }
+  }
+
+  namespace decimal { inline namespace __7 { } }
+
+  namespace chrono { inline namespace __7 { } }
+  namespace placeholders { inline namespace __7 { } }
+  namespace regex_constants { inline namespace __7 { } }
+  namespace this_thread { inline namespace __7 { } }
+
+  namespace __detail { inline namespace __7 { } }
+  namespace __regex { inline namespace __7 { } }
+}
+
+namespace __gnu_cxx
+{
+  inline namespace __7 { }
+  namespace __detail { inline namespace __7 { } }
+}
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 {
+# define _GLIBCXX_END_NAMESPACE_VERSION }
+#else
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+
+// Inline namespaces for special modes: debug, parallel, profile.
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
+    || defined(_GLIBCXX_PROFILE)
+namespace std
+{
+  // Non-inline namespace for components replaced by alternates in active mode.
+  namespace __cxx1998
+  {
+#if _GLIBCXX_INLINE_VERSION
+ inline namespace __7 { }
+#endif
+  }
+
+  // Inline namespace for debug mode.
+# ifdef _GLIBCXX_DEBUG
+  inline namespace __debug { }
+# endif
+
+  // Inline namespaces for parallel mode.
+# ifdef _GLIBCXX_PARALLEL
+  inline namespace __parallel { }
+# endif
+
+  // Inline namespaces for profile mode
+# ifdef _GLIBCXX_PROFILE
+  inline namespace __profile { }
+# endif
+}
+
+// Check for invalid usage and unsupported mixed-mode use.
+# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+
+// Check for invalid use due to lack for weak symbols.
+# if __NO_INLINE__ && !__GXX_WEAK__
+#  warning currently using inlined namespace mode which may fail \
+   without inlining due to lack of weak symbols
+# endif
+#endif
+
+// Macros for namespace scope. Either namespace std:: or the name
+// of some nested namespace within it corresponding to the active mode.
+// _GLIBCXX_STD_A
+// _GLIBCXX_STD_C
+//
+// Macros for opening/closing conditional namespaces.
+// _GLIBCXX_BEGIN_NAMESPACE_ALGO
+// _GLIBCXX_END_NAMESPACE_ALGO
+// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+// _GLIBCXX_END_NAMESPACE_CONTAINER
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
+# define _GLIBCXX_STD_C __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
+	 namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_CONTAINER \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+# undef _GLIBCXX_EXTERN_TEMPLATE
+#  define _GLIBCXX_EXTERN_TEMPLATE 1 -1
+#endif
+
+#ifdef _GLIBCXX_PARALLEL
+# define _GLIBCXX_STD_A __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
+	 namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_ALGO \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+#ifndef _GLIBCXX_STD_A
+# define _GLIBCXX_STD_A std
+#endif
+
+#ifndef _GLIBCXX_STD_C
+# define _GLIBCXX_STD_C std
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_ALGO
+# define _GLIBCXX_END_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_CONTAINER
+# define _GLIBCXX_END_NAMESPACE_CONTAINER
+#endif
+
+// GLIBCXX_ABI Deprecated
+// Define if compatibility should be provided for -mlong-double-64.
+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+// Inline namespace for long double 128 mode.
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+namespace std
+{
+  inline namespace __gnu_cxx_ldbl128 { }
+}
+# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
+# define _GLIBCXX_END_NAMESPACE_LDBL }
+#else
+# define _GLIBCXX_NAMESPACE_LDBL
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
+# define _GLIBCXX_END_NAMESPACE_LDBL
+#endif
+
+// Assert.
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
+# define __glibcxx_assert(_Condition)
+#else
+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();
+  }
+}
+#define __glibcxx_assert(_Condition)				   	 \
+  do 									 \
+  {							      		 \
+    if (! (_Condition))                                                  \
+      std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+				#_Condition);				 \
+  } while (false)
+#endif
+
+// Macros for race detectors.
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
+// atomic (lock-free) synchronization to race detectors:
+// the race detector will infer a happens-before arc from the former to the
+// latter when they share the same argument pointer.
+//
+// The most frequent use case for these macros (and the only case in the
+// current implementation of the library) is atomic reference counting:
+//   void _M_remove_reference()
+//   {
+//     _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
+//     if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
+//       {
+//         _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
+//         _M_destroy(__a);
+//       }
+//   }
+// The annotations in this example tell the race detector that all memory
+// accesses occurred when the refcount was positive do not race with
+// memory accesses which occurred after the refcount became zero.
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
+#endif
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
+#endif
+
+// Macros for C linkage: define extern "C" linkage only when using C++.
+# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
+# define _GLIBCXX_END_EXTERN_C }
+
+#else // !__cplusplus
+# 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>
+
+// If platform uses neither visibility nor psuedo-visibility,
+// specify empty default for namespace annotation macros.
+#ifndef _GLIBCXX_PSEUDO_VISIBILITY
+# define _GLIBCXX_PSEUDO_VISIBILITY(V)
+#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
+
+
+// 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 settings discovered at configure time follow.
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `acosf' function. */
+/* #undef _GLIBCXX_HAVE_ACOSF */
+
+/* Define to 1 if you have the `acosl' function. */
+/* #undef _GLIBCXX_HAVE_ACOSL */
+
+/* Define to 1 if you have the `asinf' function. */
+/* #undef _GLIBCXX_HAVE_ASINF */
+
+/* Define to 1 if you have the `asinl' function. */
+/* #undef _GLIBCXX_HAVE_ASINL */
+
+/* Define to 1 if the target assembler supports .symver directive. */
+#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
+
+/* Define to 1 if you have the `atan2f' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2F */
+
+/* Define to 1 if you have the `atan2l' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2L */
+
+/* Define to 1 if you have the `atanf' function. */
+/* #undef _GLIBCXX_HAVE_ATANF */
+
+/* Define to 1 if you have the `atanl' function. */
+/* #undef _GLIBCXX_HAVE_ATANL */
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_CC_TLS */
+
+/* Define to 1 if you have the `ceilf' function. */
+/* #undef _GLIBCXX_HAVE_CEILF */
+
+/* Define to 1 if you have the `ceill' function. */
+/* #undef _GLIBCXX_HAVE_CEILL */
+
+/* Define to 1 if you have the <complex.h> header file. */
+/* #undef _GLIBCXX_HAVE_COMPLEX_H */
+
+/* Define to 1 if you have the `cosf' function. */
+/* #undef _GLIBCXX_HAVE_COSF */
+
+/* Define to 1 if you have the `coshf' function. */
+/* #undef _GLIBCXX_HAVE_COSHF */
+
+/* Define to 1 if you have the `coshl' function. */
+/* #undef _GLIBCXX_HAVE_COSHL */
+
+/* Define to 1 if you have the `cosl' function. */
+/* #undef _GLIBCXX_HAVE_COSL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _GLIBCXX_HAVE_DLFCN_H 1
+
+/* Define if EBADMSG exists. */
+#define _GLIBCXX_HAVE_EBADMSG 1
+
+/* Define if ECANCELED exists. */
+#define _GLIBCXX_HAVE_ECANCELED 1
+
+/* Define if EIDRM exists. */
+#define _GLIBCXX_HAVE_EIDRM 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define _GLIBCXX_HAVE_ENDIAN_H 1
+
+/* Define if ENODATA exists. */
+#define _GLIBCXX_HAVE_ENODATA 1
+
+/* Define if ENOLINK exists. */
+#define _GLIBCXX_HAVE_ENOLINK 1
+
+/* Define if ENOSR exists. */
+#define _GLIBCXX_HAVE_ENOSR 1
+
+/* Define if ENOSTR exists. */
+#define _GLIBCXX_HAVE_ENOSTR 1
+
+/* Define if ENOTRECOVERABLE exists. */
+#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
+
+/* Define if ENOTSUP exists. */
+#define _GLIBCXX_HAVE_ENOTSUP 1
+
+/* Define if EOVERFLOW exists. */
+#define _GLIBCXX_HAVE_EOVERFLOW 1
+
+/* Define if EOWNERDEAD exists. */
+#define _GLIBCXX_HAVE_EOWNERDEAD 1
+
+/* Define if EPROTO exists. */
+#define _GLIBCXX_HAVE_EPROTO 1
+
+/* Define if ETIME exists. */
+#define _GLIBCXX_HAVE_ETIME 1
+
+/* Define if ETXTBSY exists. */
+#define _GLIBCXX_HAVE_ETXTBSY 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+/* #undef _GLIBCXX_HAVE_EXECINFO_H */
+
+/* Define to 1 if you have the `expf' function. */
+/* #undef _GLIBCXX_HAVE_EXPF */
+
+/* Define to 1 if you have the `expl' function. */
+/* #undef _GLIBCXX_HAVE_EXPL */
+
+/* Define to 1 if you have the `fabsf' function. */
+/* #undef _GLIBCXX_HAVE_FABSF */
+
+/* Define to 1 if you have the `fabsl' function. */
+/* #undef _GLIBCXX_HAVE_FABSL */
+
+/* Define to 1 if you have the <fenv.h> header file. */
+#define _GLIBCXX_HAVE_FENV_H 1
+
+/* Define to 1 if you have the `finite' function. */
+/* #undef _GLIBCXX_HAVE_FINITE */
+
+/* Define to 1 if you have the `finitef' function. */
+/* #undef _GLIBCXX_HAVE_FINITEF */
+
+/* Define to 1 if you have the `finitel' function. */
+/* #undef _GLIBCXX_HAVE_FINITEL */
+
+/* Define to 1 if you have the <float.h> header file. */
+#define _GLIBCXX_HAVE_FLOAT_H 1
+
+/* Define to 1 if you have the `floorf' function. */
+/* #undef _GLIBCXX_HAVE_FLOORF */
+
+/* Define to 1 if you have the `floorl' function. */
+/* #undef _GLIBCXX_HAVE_FLOORL */
+
+/* Define to 1 if you have the `fmodf' function. */
+/* #undef _GLIBCXX_HAVE_FMODF */
+
+/* Define to 1 if you have the `fmodl' function. */
+/* #undef _GLIBCXX_HAVE_FMODL */
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef _GLIBCXX_HAVE_FPCLASS */
+
+/* Define to 1 if you have the <fp.h> header file. */
+/* #undef _GLIBCXX_HAVE_FP_H */
+
+/* Define to 1 if you have the `frexpf' function. */
+/* #undef _GLIBCXX_HAVE_FREXPF */
+
+/* Define to 1 if you have the `frexpl' function. */
+/* #undef _GLIBCXX_HAVE_FREXPL */
+
+/* Define if _Unwind_GetIPInfo is available. */
+#define _GLIBCXX_HAVE_GETIPINFO 1
+
+/* Define if gthr-default.h exists (meaning that threading support is
+   enabled). */
+/* #undef _GLIBCXX_HAVE_GTHR_DEFAULT */
+
+/* Define to 1 if you have the `hypot' function. */
+/* #undef _GLIBCXX_HAVE_HYPOT */
+
+/* Define to 1 if you have the `hypotf' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTF */
+
+/* Define to 1 if you have the `hypotl' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTL */
+
+/* Define if you have the iconv() function. */
+/* #undef _GLIBCXX_HAVE_ICONV */
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef _GLIBCXX_HAVE_IEEEFP_H */
+
+/* Define if int64_t is available in <stdint.h>. */
+#define _GLIBCXX_HAVE_INT64_T 1
+
+/* Define if int64_t is a long. */
+/* #undef _GLIBCXX_HAVE_INT64_T_LONG */
+
+/* Define if int64_t is a long long. */
+#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _GLIBCXX_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isinf' function. */
+/* #undef _GLIBCXX_HAVE_ISINF */
+
+/* Define to 1 if you have the `isinff' function. */
+/* #undef _GLIBCXX_HAVE_ISINFF */
+
+/* Define to 1 if you have the `isinfl' function. */
+/* #undef _GLIBCXX_HAVE_ISINFL */
+
+/* Define to 1 if you have the `isnan' function. */
+/* #undef _GLIBCXX_HAVE_ISNAN */
+
+/* Define to 1 if you have the `isnanf' function. */
+/* #undef _GLIBCXX_HAVE_ISNANF */
+
+/* Define to 1 if you have the `isnanl' function. */
+/* #undef _GLIBCXX_HAVE_ISNANL */
+
+/* Defined if iswblank exists. */
+/* #undef _GLIBCXX_HAVE_ISWBLANK */
+
+/* Define if LC_MESSAGES is available in <locale.h>. */
+#define _GLIBCXX_HAVE_LC_MESSAGES 1
+
+/* Define to 1 if you have the `ldexpf' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPF */
+
+/* Define to 1 if you have the `ldexpl' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPL */
+
+/* Define to 1 if you have the <libintl.h> header file. */
+/* #undef _GLIBCXX_HAVE_LIBINTL_H */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_AS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_DATA */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_FSIZE */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_RSS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_VMEM */
+
+/* Define if futex syscall is available. */
+/* #undef _GLIBCXX_HAVE_LINUX_FUTEX */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define _GLIBCXX_HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `log10f' function. */
+/* #undef _GLIBCXX_HAVE_LOG10F */
+
+/* Define to 1 if you have the `log10l' function. */
+/* #undef _GLIBCXX_HAVE_LOG10L */
+
+/* Define to 1 if you have the `logf' function. */
+/* #undef _GLIBCXX_HAVE_LOGF */
+
+/* Define to 1 if you have the `logl' function. */
+/* #undef _GLIBCXX_HAVE_LOGL */
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
+
+/* Define to 1 if you have the <machine/param.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
+
+/* Define if mbstate_t exists in wchar.h. */
+#define _GLIBCXX_HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _GLIBCXX_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `modf' function. */
+/* #undef _GLIBCXX_HAVE_MODF */
+
+/* Define to 1 if you have the `modff' function. */
+/* #undef _GLIBCXX_HAVE_MODFF */
+
+/* Define to 1 if you have the `modfl' function. */
+/* #undef _GLIBCXX_HAVE_MODFL */
+
+/* Define to 1 if you have the <nan.h> header file. */
+/* #undef _GLIBCXX_HAVE_NAN_H */
+
+/* Define if poll is available in <poll.h>. */
+/* #undef _GLIBCXX_HAVE_POLL */
+
+/* Define to 1 if you have the `powf' function. */
+/* #undef _GLIBCXX_HAVE_POWF */
+
+/* Define to 1 if you have the `powl' function. */
+/* #undef _GLIBCXX_HAVE_POWL */
+
+/* Define to 1 if you have the `qfpclass' function. */
+/* #undef _GLIBCXX_HAVE_QFPCLASS */
+
+/* Define to 1 if you have the `setenv' function. */
+/* #undef _GLIBCXX_HAVE_SETENV */
+
+/* Define to 1 if you have the `sincos' function. */
+/* #undef _GLIBCXX_HAVE_SINCOS */
+
+/* Define to 1 if you have the `sincosf' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSF */
+
+/* Define to 1 if you have the `sincosl' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSL */
+
+/* Define to 1 if you have the `sinf' function. */
+/* #undef _GLIBCXX_HAVE_SINF */
+
+/* Define to 1 if you have the `sinhf' function. */
+/* #undef _GLIBCXX_HAVE_SINHF */
+
+/* Define to 1 if you have the `sinhl' function. */
+/* #undef _GLIBCXX_HAVE_SINHL */
+
+/* Define to 1 if you have the `sinl' function. */
+/* #undef _GLIBCXX_HAVE_SINL */
+
+/* Define to 1 if you have the `sqrtf' function. */
+/* #undef _GLIBCXX_HAVE_SQRTF */
+
+/* Define to 1 if you have the `sqrtl' function. */
+/* #undef _GLIBCXX_HAVE_SQRTL */
+
+/* Define to 1 if you have the <stdbool.h> header file. */
+#define _GLIBCXX_HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _GLIBCXX_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _GLIBCXX_HAVE_STDLIB_H 1
+
+/* Define if strerror_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRERROR_L */
+
+/* Define if strerror_r is available in <string.h>. */
+#define _GLIBCXX_HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _GLIBCXX_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _GLIBCXX_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtof' function. */
+/* #undef _GLIBCXX_HAVE_STRTOF */
+
+/* Define to 1 if you have the `strtold' function. */
+/* #undef _GLIBCXX_HAVE_STRTOLD */
+
+/* Define if strxfrm_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRXFRM_L */
+
+/* Define to 1 if the target runtime linker supports binding the same symbol
+   to different versions. */
+/* #undef _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT */
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the <sys/isa_defs.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
+
+/* Define to 1 if you have the <sys/machine.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _GLIBCXX_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_SEM_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _GLIBCXX_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define _GLIBCXX_HAVE_SYS_UIO_H 1
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_IFREG */
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_ISREG */
+
+/* Define to 1 if you have the `tanf' function. */
+/* #undef _GLIBCXX_HAVE_TANF */
+
+/* Define to 1 if you have the `tanhf' function. */
+/* #undef _GLIBCXX_HAVE_TANHF */
+
+/* Define to 1 if you have the `tanhl' function. */
+/* #undef _GLIBCXX_HAVE_TANHL */
+
+/* Define to 1 if you have the `tanl' function. */
+/* #undef _GLIBCXX_HAVE_TANL */
+
+/* Define to 1 if you have the <tgmath.h> header file. */
+/* #undef _GLIBCXX_HAVE_TGMATH_H */
+
+/* Define to 1 if the target supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_TLS */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _GLIBCXX_HAVE_UNISTD_H 1
+
+/* Defined if vfwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VFWSCANF */
+
+/* Defined if vswscanf exists. */
+/* #undef _GLIBCXX_HAVE_VSWSCANF */
+
+/* Defined if vwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VWSCANF */
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define _GLIBCXX_HAVE_WCHAR_H 1
+
+/* Defined if wcstof exists. */
+/* #undef _GLIBCXX_HAVE_WCSTOF */
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define _GLIBCXX_HAVE_WCTYPE_H 1
+
+/* Define if writev is available in <sys/uio.h>. */
+/* #undef _GLIBCXX_HAVE_WRITEV */
+
+/* Define to 1 if you have the `_acosf' function. */
+/* #undef _GLIBCXX_HAVE__ACOSF */
+
+/* Define to 1 if you have the `_acosl' function. */
+/* #undef _GLIBCXX_HAVE__ACOSL */
+
+/* Define to 1 if you have the `_asinf' function. */
+/* #undef _GLIBCXX_HAVE__ASINF */
+
+/* Define to 1 if you have the `_asinl' function. */
+/* #undef _GLIBCXX_HAVE__ASINL */
+
+/* Define to 1 if you have the `_atan2f' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2F */
+
+/* Define to 1 if you have the `_atan2l' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2L */
+
+/* Define to 1 if you have the `_atanf' function. */
+/* #undef _GLIBCXX_HAVE__ATANF */
+
+/* Define to 1 if you have the `_atanl' function. */
+/* #undef _GLIBCXX_HAVE__ATANL */
+
+/* Define to 1 if you have the `_ceilf' function. */
+/* #undef _GLIBCXX_HAVE__CEILF */
+
+/* Define to 1 if you have the `_ceill' function. */
+/* #undef _GLIBCXX_HAVE__CEILL */
+
+/* Define to 1 if you have the `_cosf' function. */
+/* #undef _GLIBCXX_HAVE__COSF */
+
+/* Define to 1 if you have the `_coshf' function. */
+/* #undef _GLIBCXX_HAVE__COSHF */
+
+/* Define to 1 if you have the `_coshl' function. */
+/* #undef _GLIBCXX_HAVE__COSHL */
+
+/* Define to 1 if you have the `_cosl' function. */
+/* #undef _GLIBCXX_HAVE__COSL */
+
+/* Define to 1 if you have the `_expf' function. */
+/* #undef _GLIBCXX_HAVE__EXPF */
+
+/* Define to 1 if you have the `_expl' function. */
+/* #undef _GLIBCXX_HAVE__EXPL */
+
+/* Define to 1 if you have the `_fabsf' function. */
+/* #undef _GLIBCXX_HAVE__FABSF */
+
+/* Define to 1 if you have the `_fabsl' function. */
+/* #undef _GLIBCXX_HAVE__FABSL */
+
+/* Define to 1 if you have the `_finite' function. */
+/* #undef _GLIBCXX_HAVE__FINITE */
+
+/* Define to 1 if you have the `_finitef' function. */
+/* #undef _GLIBCXX_HAVE__FINITEF */
+
+/* Define to 1 if you have the `_finitel' function. */
+/* #undef _GLIBCXX_HAVE__FINITEL */
+
+/* Define to 1 if you have the `_floorf' function. */
+/* #undef _GLIBCXX_HAVE__FLOORF */
+
+/* Define to 1 if you have the `_floorl' function. */
+/* #undef _GLIBCXX_HAVE__FLOORL */
+
+/* Define to 1 if you have the `_fmodf' function. */
+/* #undef _GLIBCXX_HAVE__FMODF */
+
+/* Define to 1 if you have the `_fmodl' function. */
+/* #undef _GLIBCXX_HAVE__FMODL */
+
+/* Define to 1 if you have the `_fpclass' function. */
+/* #undef _GLIBCXX_HAVE__FPCLASS */
+
+/* Define to 1 if you have the `_frexpf' function. */
+/* #undef _GLIBCXX_HAVE__FREXPF */
+
+/* Define to 1 if you have the `_frexpl' function. */
+/* #undef _GLIBCXX_HAVE__FREXPL */
+
+/* Define to 1 if you have the `_hypot' function. */
+/* #undef _GLIBCXX_HAVE__HYPOT */
+
+/* Define to 1 if you have the `_hypotf' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTF */
+
+/* Define to 1 if you have the `_hypotl' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTL */
+
+/* Define to 1 if you have the `_isinf' function. */
+/* #undef _GLIBCXX_HAVE__ISINF */
+
+/* Define to 1 if you have the `_isinff' function. */
+/* #undef _GLIBCXX_HAVE__ISINFF */
+
+/* Define to 1 if you have the `_isinfl' function. */
+/* #undef _GLIBCXX_HAVE__ISINFL */
+
+/* Define to 1 if you have the `_isnan' function. */
+/* #undef _GLIBCXX_HAVE__ISNAN */
+
+/* Define to 1 if you have the `_isnanf' function. */
+/* #undef _GLIBCXX_HAVE__ISNANF */
+
+/* Define to 1 if you have the `_isnanl' function. */
+/* #undef _GLIBCXX_HAVE__ISNANL */
+
+/* Define to 1 if you have the `_ldexpf' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPF */
+
+/* Define to 1 if you have the `_ldexpl' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPL */
+
+/* Define to 1 if you have the `_log10f' function. */
+/* #undef _GLIBCXX_HAVE__LOG10F */
+
+/* Define to 1 if you have the `_log10l' function. */
+/* #undef _GLIBCXX_HAVE__LOG10L */
+
+/* Define to 1 if you have the `_logf' function. */
+/* #undef _GLIBCXX_HAVE__LOGF */
+
+/* Define to 1 if you have the `_logl' function. */
+/* #undef _GLIBCXX_HAVE__LOGL */
+
+/* Define to 1 if you have the `_modf' function. */
+/* #undef _GLIBCXX_HAVE__MODF */
+
+/* Define to 1 if you have the `_modff' function. */
+/* #undef _GLIBCXX_HAVE__MODFF */
+
+/* Define to 1 if you have the `_modfl' function. */
+/* #undef _GLIBCXX_HAVE__MODFL */
+
+/* Define to 1 if you have the `_powf' function. */
+/* #undef _GLIBCXX_HAVE__POWF */
+
+/* Define to 1 if you have the `_powl' function. */
+/* #undef _GLIBCXX_HAVE__POWL */
+
+/* Define to 1 if you have the `_qfpclass' function. */
+/* #undef _GLIBCXX_HAVE__QFPCLASS */
+
+/* Define to 1 if you have the `_sincos' function. */
+/* #undef _GLIBCXX_HAVE__SINCOS */
+
+/* Define to 1 if you have the `_sincosf' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSF */
+
+/* Define to 1 if you have the `_sincosl' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSL */
+
+/* Define to 1 if you have the `_sinf' function. */
+/* #undef _GLIBCXX_HAVE__SINF */
+
+/* Define to 1 if you have the `_sinhf' function. */
+/* #undef _GLIBCXX_HAVE__SINHF */
+
+/* Define to 1 if you have the `_sinhl' function. */
+/* #undef _GLIBCXX_HAVE__SINHL */
+
+/* Define to 1 if you have the `_sinl' function. */
+/* #undef _GLIBCXX_HAVE__SINL */
+
+/* Define to 1 if you have the `_sqrtf' function. */
+/* #undef _GLIBCXX_HAVE__SQRTF */
+
+/* Define to 1 if you have the `_sqrtl' function. */
+/* #undef _GLIBCXX_HAVE__SQRTL */
+
+/* Define to 1 if you have the `_tanf' function. */
+/* #undef _GLIBCXX_HAVE__TANF */
+
+/* Define to 1 if you have the `_tanhf' function. */
+/* #undef _GLIBCXX_HAVE__TANHF */
+
+/* Define to 1 if you have the `_tanhl' function. */
+/* #undef _GLIBCXX_HAVE__TANHL */
+
+/* Define to 1 if you have the `_tanl' function. */
+/* #undef _GLIBCXX_HAVE__TANL */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef _GLIBCXX_ICONV_CONST */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+/* #undef _GLIBCXX_PACKAGE */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _GLIBCXX_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _GLIBCXX_PACKAGE_NAME "package-unused"
+
+/* Define to the full name and version of this package. */
+#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
+
+/* Define to the one symbol short name of this package. */
+#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
+
+/* Define to the home page for this package. */
+#define _GLIBCXX_PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void *', as computed by sizeof. */
+/* #undef SIZEOF_VOID_P */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+/* #undef _GLIBCXX_VERSION */
+
+/* Define if builtin atomic operations for bool are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+
+/* Define if builtin atomic operations for short are supported on this host.
+   */
+#define _GLIBCXX_ATOMIC_BUILTINS_2 1
+
+/* Define if builtin atomic operations for int are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_4 1
+
+/* Define if builtin atomic operations for long long are supported on this
+   host. */
+/* #undef _GLIBCXX_ATOMIC_BUILTINS_8 */
+
+/* Define to use concept checking code from the boost libraries. */
+/* #undef _GLIBCXX_CONCEPT_CHECKS */
+
+/* Define if a fully dynamic basic_string is wanted. */
+/* #undef _GLIBCXX_FULLY_DYNAMIC_STRING */
+
+/* Define if gthreads library is available. */
+/* #undef _GLIBCXX_HAS_GTHREADS */
+
+/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
+#define _GLIBCXX_HOSTED 1
+
+/* Define if compatibility should be provided for -mlong-double-64. */
+
+/* Define if ptrdiff_t is int. */
+#define _GLIBCXX_PTRDIFF_T_IS_INT 1
+
+/* Define if using setrlimit to set resource limits during "make check" */
+/* #undef _GLIBCXX_RES_LIMITS */
+
+/* Define if size_t is unsigned int. */
+#define _GLIBCXX_SIZE_T_IS_UINT 1
+
+/* Define if the compiler is configured for setjmp/longjmp exceptions. */
+/* #undef _GLIBCXX_SJLJ_EXCEPTIONS */
+
+/* Define to the value of the EOF integer constant. */
+#define _GLIBCXX_STDIO_EOF -1
+
+/* Define to the value of the SEEK_CUR integer constant. */
+#define _GLIBCXX_STDIO_SEEK_CUR 1
+
+/* Define to the value of the SEEK_END integer constant. */
+#define _GLIBCXX_STDIO_SEEK_END 2
+
+/* Define to use symbol versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER */
+
+/* Define to use darwin versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_DARWIN */
+
+/* Define to use GNU versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU */
+
+/* Define to use GNU namespace versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
+
+/* Define to use Sun versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_SUN */
+
+/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
+   <stdio.h>, and <stdlib.h> can be used or exposed. */
+/* #undef _GLIBCXX_USE_C99 */
+
+/* Define if C99 functions in <complex.h> should be used in <complex>. Using
+   compiler builtins for these functions requires corresponding C99 library
+   functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX */
+
+/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
+   Using compiler builtins for these functions requires corresponding C99
+   library functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX_TR1 */
+
+/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_CTYPE_TR1 1
+
+/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_FENV_TR1 1
+
+/* Define if C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
+
+/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 */
+
+/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
+   in namespace std. */
+/* #undef _GLIBCXX_USE_C99_MATH */
+
+/* Define if C99 functions or macros in <math.h> should be imported in
+   <tr1/cmath> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_MATH_TR1 */
+
+/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_STDINT_TR1 1
+
+/* Defined if clock_gettime has monotonic clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_MONOTONIC */
+
+/* Defined if clock_gettime has realtime clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_REALTIME */
+
+/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
+   this host. */
+/* #undef _GLIBCXX_USE_DECIMAL_FLOAT */
+
+/* Defined if gettimeofday is available. */
+/* #undef _GLIBCXX_USE_GETTIMEOFDAY */
+
+/* Define if LFS support is available. */
+/* #undef _GLIBCXX_USE_LFS */
+
+/* Define if code specialized for long long should be used. */
+#define _GLIBCXX_USE_LONG_LONG 1
+
+/* Defined if nanosleep is available. */
+/* #undef _GLIBCXX_USE_NANOSLEEP */
+
+/* Define if NLS translations are to be used. */
+/* #undef _GLIBCXX_USE_NLS */
+
+/* Define if /dev/random and /dev/urandom are available for the random_device
+   of TR1 (Chapter 5.1). */
+#define _GLIBCXX_USE_RANDOM_TR1 1
+
+/* Defined if sched_yield is available. */
+/* #undef _GLIBCXX_USE_SCHED_YIELD */
+
+/* Define if code specialized for wchar_t should be used. */
+#define _GLIBCXX_USE_WCHAR_T 1
+
+#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
+# define _GLIBCXX_HAVE_ACOSF 1
+# define acosf _acosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
+# define _GLIBCXX_HAVE_ACOSL 1
+# define acosl _acosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
+# define _GLIBCXX_HAVE_ASINF 1
+# define asinf _asinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
+# define _GLIBCXX_HAVE_ASINL 1
+# define asinl _asinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
+# define _GLIBCXX_HAVE_ATAN2F 1
+# define atan2f _atan2f
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
+# define _GLIBCXX_HAVE_ATAN2L 1
+# define atan2l _atan2l
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
+# define _GLIBCXX_HAVE_ATANF 1
+# define atanf _atanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
+# define _GLIBCXX_HAVE_ATANL 1
+# define atanl _atanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
+# define _GLIBCXX_HAVE_CEILF 1
+# define ceilf _ceilf
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
+# define _GLIBCXX_HAVE_CEILL 1
+# define ceill _ceill
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
+# define _GLIBCXX_HAVE_COSF 1
+# define cosf _cosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
+# define _GLIBCXX_HAVE_COSHF 1
+# define coshf _coshf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
+# define _GLIBCXX_HAVE_COSHL 1
+# define coshl _coshl
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
+# define _GLIBCXX_HAVE_COSL 1
+# define cosl _cosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
+# define _GLIBCXX_HAVE_EXPF 1
+# define expf _expf
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
+# define _GLIBCXX_HAVE_EXPL 1
+# define expl _expl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
+# define _GLIBCXX_HAVE_FABSF 1
+# define fabsf _fabsf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
+# define _GLIBCXX_HAVE_FABSL 1
+# define fabsl _fabsl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
+# define _GLIBCXX_HAVE_FINITE 1
+# define finite _finite
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
+# define _GLIBCXX_HAVE_FINITEF 1
+# define finitef _finitef
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
+# define _GLIBCXX_HAVE_FINITEL 1
+# define finitel _finitel
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
+# define _GLIBCXX_HAVE_FLOORF 1
+# define floorf _floorf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
+# define _GLIBCXX_HAVE_FLOORL 1
+# define floorl _floorl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
+# define _GLIBCXX_HAVE_FMODF 1
+# define fmodf _fmodf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
+# define _GLIBCXX_HAVE_FMODL 1
+# define fmodl _fmodl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
+# define _GLIBCXX_HAVE_FPCLASS 1
+# define fpclass _fpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
+# define _GLIBCXX_HAVE_FREXPF 1
+# define frexpf _frexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
+# define _GLIBCXX_HAVE_FREXPL 1
+# define frexpl _frexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
+# define _GLIBCXX_HAVE_HYPOT 1
+# define hypot _hypot
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
+# define _GLIBCXX_HAVE_HYPOTF 1
+# define hypotf _hypotf
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
+# define _GLIBCXX_HAVE_HYPOTL 1
+# define hypotl _hypotl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
+# define _GLIBCXX_HAVE_ISINF 1
+# define isinf _isinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
+# define _GLIBCXX_HAVE_ISINFF 1
+# define isinff _isinff
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
+# define _GLIBCXX_HAVE_ISINFL 1
+# define isinfl _isinfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
+# define _GLIBCXX_HAVE_ISNAN 1
+# define isnan _isnan
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
+# define _GLIBCXX_HAVE_ISNANF 1
+# define isnanf _isnanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
+# define _GLIBCXX_HAVE_ISNANL 1
+# define isnanl _isnanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
+# define _GLIBCXX_HAVE_LDEXPF 1
+# define ldexpf _ldexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
+# define _GLIBCXX_HAVE_LDEXPL 1
+# define ldexpl _ldexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
+# define _GLIBCXX_HAVE_LOG10F 1
+# define log10f _log10f
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
+# define _GLIBCXX_HAVE_LOG10L 1
+# define log10l _log10l
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
+# define _GLIBCXX_HAVE_LOGF 1
+# define logf _logf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
+# define _GLIBCXX_HAVE_LOGL 1
+# define logl _logl
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
+# define _GLIBCXX_HAVE_MODF 1
+# define modf _modf
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
+# define _GLIBCXX_HAVE_MODFF 1
+# define modff _modff
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
+# define _GLIBCXX_HAVE_MODFL 1
+# define modfl _modfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
+# define _GLIBCXX_HAVE_POWF 1
+# define powf _powf
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
+# define _GLIBCXX_HAVE_POWL 1
+# define powl _powl
+#endif
+
+#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
+# define _GLIBCXX_HAVE_QFPCLASS 1
+# define qfpclass _qfpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
+# define _GLIBCXX_HAVE_SINCOS 1
+# define sincos _sincos
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
+# define _GLIBCXX_HAVE_SINCOSF 1
+# define sincosf _sincosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
+# define _GLIBCXX_HAVE_SINCOSL 1
+# define sincosl _sincosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
+# define _GLIBCXX_HAVE_SINF 1
+# define sinf _sinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
+# define _GLIBCXX_HAVE_SINHF 1
+# define sinhf _sinhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
+# define _GLIBCXX_HAVE_SINHL 1
+# define sinhl _sinhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
+# define _GLIBCXX_HAVE_SINL 1
+# define sinl _sinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
+# define _GLIBCXX_HAVE_SQRTF 1
+# define sqrtf _sqrtf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
+# define _GLIBCXX_HAVE_SQRTL 1
+# define sqrtl _sqrtl
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
+# define _GLIBCXX_HAVE_STRTOF 1
+# define strtof _strtof
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
+# define _GLIBCXX_HAVE_STRTOLD 1
+# define strtold _strtold
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
+# define _GLIBCXX_HAVE_TANF 1
+# define tanf _tanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
+# define _GLIBCXX_HAVE_TANHF 1
+# define tanhf _tanhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
+# define _GLIBCXX_HAVE_TANHL 1
+# define tanhl _tanhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
+# define _GLIBCXX_HAVE_TANL 1
+# define tanl _tanl
+#endif
+
+#endif // _GLIBCXX_CXX_CONFIG_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++io.h
@@ -0,0 +1,51 @@
+// Underlying io library details -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++io.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+// c_io_stdio.h - Defines for using "C" stdio.h
+
+#ifndef _GLIBCXX_CXX_IO_H
+#define _GLIBCXX_CXX_IO_H 1
+
+#include <cstdio>
+#include <bits/gthr.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef __gthread_mutex_t __c_lock;
+
+  // for basic_file.h
+  typedef FILE __c_file;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++locale.h
@@ -0,0 +1,93 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++locale.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#ifndef _GLIBCXX_CXX_LOCALE_H
+#define _GLIBCXX_CXX_LOCALE_H 1
+
+#pragma GCC system_header
+
+#include <clocale>
+
+#define _GLIBCXX_NUM_CATEGORIES 0
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef int*			__c_locale;
+
+  // Convert numeric value of type double and long double to string and
+  // return length of string.  If vsnprintf is available use it, otherwise
+  // fall back to the unsafe vsprintf which, in general, can be dangerous
+  // and should be avoided.
+  inline int
+  __convert_from_v(const __c_locale&, char* __out, 
+		   const int __size __attribute__((__unused__)),
+		   const char* __fmt, ...)
+  {
+    char* __old = std::setlocale(LC_NUMERIC, 0);
+    char* __sav = 0;
+    if (__old && __builtin_strcmp(__old, "C"))
+      {
+	const size_t __len = __builtin_strlen(__old) + 1;
+	__sav = new char[__len];
+	__builtin_memcpy(__sav, __old, __len);
+	std::setlocale(LC_NUMERIC, "C");
+      }
+
+    __builtin_va_list __args;
+    __builtin_va_start(__args, __fmt);
+
+#ifdef _GLIBCXX_USE_C99
+    const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
+#else
+    const int __ret = __builtin_vsprintf(__out, __fmt, __args);
+#endif
+
+    __builtin_va_end(__args);
+
+    if (__sav)
+      {
+	std::setlocale(LC_NUMERIC, __sav);
+	delete [] __sav;
+      }
+    return __ret;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cpu_defines.h
@@ -0,0 +1,33 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cpu_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_base.h
@@ -0,0 +1,60 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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
+//
+
+// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
+
+// Support for Solaris 2.5.1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int* 		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef char 		mask;
+    static const mask upper    	= _U;
+    static const mask lower 	= _L;
+    static const mask alpha 	= _U | _L;
+    static const mask digit 	= _N;
+    static const mask xdigit 	= _X | _N;
+    static const mask space 	= _S;
+    static const mask print 	= _P | _U | _L | _N | _B;
+    static const mask graph 	= _P | _U | _L | _N;
+    static const mask cntrl 	= _C;
+    static const mask punct 	= _P;
+    static const mask alnum 	= _U | _L | _N;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_inline.h
@@ -0,0 +1,74 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    while (__low < __high)
+      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && !this->is(__m, *__low))
+      ++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && this->is(__m, *__low) != 0)
+      ++__low;
+    return __low;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_noninline.h
@@ -0,0 +1,98 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_noninline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return _ctype_ + 1; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+		     size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x);
+  }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_toupper(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
+  }
+
+  const char*
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_tolower(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..f48f73e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cxxabi_tweaks.h
@@ -0,0 +1,59 @@
+// Control various target specific ABI tweaks.  Generic version.
+
+// Copyright (C) 2004, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cxxabi_tweaks.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{cxxabi.h}
+ */
+
+#ifndef _CXXABI_TWEAKS_H
+#define _CXXABI_TWEAKS_H 1
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{
+  extern "C" 
+  {
+#endif
+
+  // The generic ABI uses the first byte of a 64-bit guard variable.
+#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
+#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
+  __extension__ typedef int __guard __attribute__((mode (__DI__)));
+
+  // __cxa_vec_ctor has void return type.
+  typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+  // Constructors and destructors do not return a value.
+  typedef void __cxa_cdtor_return_type;
+
+#ifdef __cplusplus
+  }
+} // namespace __cxxabiv1
+#endif
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/error_constants.h
@@ -0,0 +1,178 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/error_constants.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{system_error}
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#define _GLIBCXX_ERROR_CONSTANTS 1
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  enum class errc
+    {
+      address_family_not_supported = 		EAFNOSUPPORT,
+      address_in_use = 				EADDRINUSE,
+      address_not_available = 			EADDRNOTAVAIL,
+      already_connected = 			EISCONN,
+      argument_list_too_long = 			E2BIG,
+      argument_out_of_domain = 			EDOM,
+      bad_address = 				EFAULT,
+      bad_file_descriptor = 			EBADF,
+
+#ifdef _GLIBCXX_HAVE_EBADMSG
+      bad_message = 				EBADMSG,
+#endif
+
+      broken_pipe = 				EPIPE,
+      connection_aborted = 			ECONNABORTED,
+      connection_already_in_progress = 		EALREADY,
+      connection_refused = 			ECONNREFUSED,
+      connection_reset = 			ECONNRESET,
+      cross_device_link = 			EXDEV,
+      destination_address_required = 		EDESTADDRREQ,
+      device_or_resource_busy = 		EBUSY,
+      directory_not_empty = 			ENOTEMPTY,
+      executable_format_error = 		ENOEXEC,
+      file_exists = 	       			EEXIST,
+      file_too_large = 				EFBIG,
+      filename_too_long = 			ENAMETOOLONG,
+      function_not_supported = 			ENOSYS,
+      host_unreachable = 			EHOSTUNREACH,
+
+#ifdef _GLIBCXX_HAVE_EIDRM
+      identifier_removed = 			EIDRM,
+#endif
+
+      illegal_byte_sequence = 			EILSEQ,
+      inappropriate_io_control_operation = 	ENOTTY,
+      interrupted = 				EINTR,
+      invalid_argument = 			EINVAL,
+      invalid_seek = 				ESPIPE,
+      io_error = 				EIO,
+      is_a_directory = 				EISDIR,
+      message_size = 				EMSGSIZE,
+      network_down = 				ENETDOWN,
+      network_reset = 				ENETRESET,
+      network_unreachable = 			ENETUNREACH,
+      no_buffer_space = 			ENOBUFS,
+      no_child_process = 			ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+      no_link = 				ENOLINK,
+#endif
+
+      no_lock_available = 			ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+      no_message_available = 			ENODATA, 
+#endif
+
+      no_message = 				ENOMSG, 
+      no_protocol_option = 			ENOPROTOOPT,
+      no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+      no_stream_resources = 			ENOSR,
+#endif
+
+      no_such_device_or_address = 		ENXIO,
+      no_such_device = 				ENODEV,
+      no_such_file_or_directory = 		ENOENT,
+      no_such_process = 			ESRCH,
+      not_a_directory = 			ENOTDIR,
+      not_a_socket = 				ENOTSOCK,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+      not_a_stream = 				ENOSTR,
+#endif
+
+      not_connected = 				ENOTCONN,
+      not_enough_memory = 			ENOMEM,
+
+#ifdef _GLIBCXX_HAVE_ENOTSUP
+      not_supported = 				ENOTSUP,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ECANCELED
+      operation_canceled = 			ECANCELED,
+#endif
+
+      operation_in_progress = 			EINPROGRESS,
+      operation_not_permitted = 		EPERM,
+      operation_not_supported = 		EOPNOTSUPP,
+      operation_would_block = 			EWOULDBLOCK,
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead = 				EOWNERDEAD,
+#endif
+
+      permission_denied = 			EACCES,
+
+#ifdef _GLIBCXX_HAVE_EPROTO
+      protocol_error = 				EPROTO,
+#endif
+
+      protocol_not_supported = 			EPROTONOSUPPORT,
+      read_only_file_system = 			EROFS,
+      resource_deadlock_would_occur = 		EDEADLK,
+      resource_unavailable_try_again = 		EAGAIN,
+      result_out_of_range = 			ERANGE,
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+      stream_timeout = 				ETIME,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETXTBSY
+      text_file_busy = 				ETXTBSY,
+#endif
+
+      timed_out = 				ETIMEDOUT,
+      too_many_files_open_in_system = 		ENFILE,
+      too_many_files_open = 			EMFILE,
+      too_many_links = 				EMLINK,
+      too_many_symbolic_link_levels = 		ELOOP,
+
+#ifdef _GLIBCXX_HAVE_EOVERFLOW
+      value_too_large = 			EOVERFLOW,
+#endif
+
+      wrong_protocol_type = 			EPROTOTYPE
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/extc++.h
@@ -0,0 +1,71 @@
+// 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.
+ */
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/stdtr1c++.h>
+#endif
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-default.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-default.h
@@ -0,0 +1,292 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_SINGLE_H
+#define _GLIBCXX_GCC_GTHR_SINGLE_H
+
+/* Just provide compatibility for mutex handling.  */
+
+typedef int __gthread_key_t;
+typedef int __gthread_once_t;
+typedef int __gthread_mutex_t;
+typedef int __gthread_recursive_mutex_t;
+
+#define __GTHREAD_ONCE_INIT 0
+#define __GTHREAD_MUTEX_INIT 0
+#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
+
+#define _GLIBCXX_UNUSED __attribute__((unused))
+
+#ifdef _LIBOBJC
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return NULL;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+  return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  return;
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  /* No thread support available */
+  /* Should we really exit the program */
+  /* exit (&__objc_thread_exit_status); */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  /* No thread support, use 1.  */
+  return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  thread_local_storage = value;
+  return 0;
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
+			       objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 0;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int _GLIBCXX_UNUSED
+__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static int _GLIBCXX_UNUSED
+__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+#endif /* _LIBOBJC */
+
+#undef _GLIBCXX_UNUSED
+
+#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-posix.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-single.h
@@ -0,0 +1,292 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_SINGLE_H
+#define _GLIBCXX_GCC_GTHR_SINGLE_H
+
+/* Just provide compatibility for mutex handling.  */
+
+typedef int __gthread_key_t;
+typedef int __gthread_once_t;
+typedef int __gthread_mutex_t;
+typedef int __gthread_recursive_mutex_t;
+
+#define __GTHREAD_ONCE_INIT 0
+#define __GTHREAD_MUTEX_INIT 0
+#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
+
+#define _GLIBCXX_UNUSED __attribute__((unused))
+
+#ifdef _LIBOBJC
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return NULL;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+  return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  return;
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  /* No thread support available */
+  /* Should we really exit the program */
+  /* exit (&__objc_thread_exit_status); */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  /* No thread support, use 1.  */
+  return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  thread_local_storage = value;
+  return 0;
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
+			       objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 0;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int _GLIBCXX_UNUSED
+__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static int _GLIBCXX_UNUSED
+__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+#endif /* _LIBOBJC */
+
+#undef _GLIBCXX_UNUSED
+
+#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-tpf.h
@@ -0,0 +1,229 @@
+/* Threads compatibility routines for libgcc2 and libobjc.
+   Compile this one with gcc.
+   Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* TPF needs its own version of gthr-*.h because TPF always links to
+   the thread library.  However, for performance reasons we still do not
+   want to issue thread api calls unless a check is made to see that we
+   are running as a thread.  */
+
+#ifndef _GLIBCXX_GCC_GTHR_TPF_H
+#define _GLIBCXX_GCC_GTHR_TPF_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#endif
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+
+#define NOTATHREAD   00
+#define ECBBASEPTR (unsigned long int) *(unsigned int *)0x00000514u
+#define ECBPG2PTR  ECBBASEPTR + 0x1000
+#define CE2THRCPTR *((unsigned char *)(ECBPG2PTR + 16))
+#define __tpf_pthread_active() (CE2THRCPTR != NOTATHREAD)
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# define __gthrw(name) \
+  static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw(name)
+# define __gthrw_(name) name
+#endif
+
+__gthrw(pthread_once)
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+__gthrw(pthread_create)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_create) (__key, __dtor);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_delete) (__key);
+  else
+    return -1;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_getspecific) (__key);
+  else
+    return NULL;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_setspecific) (__key, __ptr);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_lock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_trylock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_unlock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+
+
+#endif /* ! _GLIBCXX_GCC_GTHR_TPF_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr.h
@@ -0,0 +1,173 @@
+/* Threads compatibility routines for libgcc2.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_H
+#define _GLIBCXX_GCC_GTHR_H
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility push(default)
+#endif
+
+/* If this file is compiled with threads support, it must
+       #define __GTHREADS 1
+   to indicate that threads support is present.  Also it has define
+   function
+     int __gthread_active_p ()
+   that returns 1 if thread system is active, 0 if not.
+
+   The threads interface must define the following types:
+     __gthread_key_t
+     __gthread_once_t
+     __gthread_mutex_t
+     __gthread_recursive_mutex_t
+
+   The threads interface must define the following macros:
+
+     __GTHREAD_ONCE_INIT
+     		to initialize __gthread_once_t
+     __GTHREAD_MUTEX_INIT
+     		to initialize __gthread_mutex_t to get a fast
+		non-recursive mutex.
+     __GTHREAD_MUTEX_INIT_FUNCTION
+     		some systems can't initialize a mutex without a
+		function call.  On such systems, define this to a
+		function which looks like this:
+		  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
+		Don't define __GTHREAD_MUTEX_INIT in this case
+     __GTHREAD_RECURSIVE_MUTEX_INIT
+     __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
+     		as above, but for a recursive mutex.
+
+   The threads interface must define the following static functions:
+
+     int __gthread_once (__gthread_once_t *once, void (*func) ())
+
+     int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
+     int __gthread_key_delete (__gthread_key_t key)
+
+     void *__gthread_getspecific (__gthread_key_t key)
+     int __gthread_setspecific (__gthread_key_t key, const void *ptr)
+
+     int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
+
+     int __gthread_mutex_lock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
+
+     int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
+
+   The following are supported in POSIX threads only. They are required to
+   fix a deadlock in static initialization inside libsupc++. The header file
+   gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
+   features are supported.
+
+   Types:
+     __gthread_cond_t
+
+   Macros:
+     __GTHREAD_COND_INIT
+     __GTHREAD_COND_INIT_FUNCTION
+
+   Interface:
+     int __gthread_cond_broadcast (__gthread_cond_t *cond);
+     int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
+     int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
+					__gthread_recursive_mutex_t *mutex);
+
+   All functions returning int should return zero on success or the error
+   number.  If the operation is not supported, -1 is returned.
+
+   If the following are also defined, you should
+     #define __GTHREADS_CXX0X 1
+   to enable the c++0x thread library.
+
+   Types:
+     __gthread_t
+     __gthread_time_t
+
+   Interface:
+     int __gthread_create (__gthread_t *thread, void *(*func) (void*),
+                           void *args);
+     int __gthread_join (__gthread_t thread, void **value_ptr);
+     int __gthread_detach (__gthread_t thread);
+     int __gthread_equal (__gthread_t t1, __gthread_t t2);
+     __gthread_t __gthread_self (void);
+     int __gthread_yield (void);
+
+     int __gthread_mutex_timedlock (__gthread_mutex_t *m,
+                                    const __gthread_time_t *abs_timeout);
+     int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
+                                          const __gthread_time_t *abs_time);
+
+     int __gthread_cond_signal (__gthread_cond_t *cond);
+     int __gthread_cond_timedwait (__gthread_cond_t *cond,
+                                   __gthread_mutex_t *mutex,
+                                   const __gthread_time_t *abs_timeout);
+     int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond,
+                                             __gthread_recursive_mutex_t *mutex,
+                                             const __gthread_time_t *abs_time)
+
+   Currently supported threads packages are
+     TPF threads with -D__tpf__
+     POSIX/Unix98 threads with -D_PTHREADS
+     POSIX/Unix95 threads with -D_PTHREADS95
+     DCE threads with -D_DCE_THREADS
+     Solaris/UI threads with -D_SOLARIS_THREADS
+
+*/
+
+/* Check first for thread specific defines.  */
+#if defined (_GLIBCXX___tpf_GLIBCXX___)
+#include <bits/gthr-tpf.h>
+#elif _GLIBCXX__PTHREADS
+#include <bits/gthr-posix.h>
+#elif _GLIBCXX__PTHREADS95
+#include <bits/gthr-posix95.h>
+#elif _GLIBCXX__DCE_THREADS
+#include <bits/gthr-dce.h>
+#elif _GLIBCXX__SOLARIS_THREADS
+#include <bits/gthr-solaris.h>
+
+/* Include GTHREAD_FILE if one is defined.  */
+#elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
+#if __GXX_WEAK__
+#ifndef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 1
+#endif
+#endif
+#include <bits/gthr-default.h>
+
+/* Fallback to single thread definitions.  */
+#else
+#include <bits/gthr-single.h>
+#endif
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility pop
+#endif
+
+#endif /* ! _GLIBCXX_GCC_GTHR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/messages_members.h
@@ -0,0 +1,93 @@
+// std::messages implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/messages_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Non-virtual member functions.
+  template<typename _CharT>
+     messages<_CharT>::messages(size_t __refs)
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+     messages<_CharT>::messages(__c_locale, const char*, size_t __refs) 
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
+			   const char*) const
+    { return this->do_open(__s, __loc); }
+
+  // Virtual member functions.
+  template<typename _CharT>
+    messages<_CharT>::~messages()
+    { _S_destroy_c_locale(_M_c_locale_messages); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
+    { return 0; }
+
+  template<typename _CharT>
+    typename messages<_CharT>::string_type  
+    messages<_CharT>::do_get(catalog, int, int, 
+			     const string_type& __dfault) const
+    { return __dfault; }
+
+  template<typename _CharT>
+    void    
+    messages<_CharT>::do_close(catalog) const 
+    { }
+
+   // messages_byname
+   template<typename _CharT>
+     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
+     : messages<_CharT>(__refs) 
+     { 
+	if (__builtin_strcmp(__s, "C") != 0
+	    && __builtin_strcmp(__s, "POSIX") != 0)
+	  {
+	    this->_S_destroy_c_locale(this->_M_c_locale_messages);
+	    this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
+	  }
+     }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/os_defines.h
@@ -0,0 +1,36 @@
+// Specific definitions for Bionic  -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/os_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdc++.h
@@ -0,0 +1,116 @@
+// C++ includes used for precompiling -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+#ifndef _GLIBCXX_NO_ASSERT
+#include <cassert>
+#endif
+#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 <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 <atomic>
+#include <chrono>
+#include <condition_variable>
+#include <forward_list>
+#include <future>
+#include <initializer_list>
+#include <mutex>
+#include <random>
+#include <ratio>
+#include <regex>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <typeindex>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdtr1c++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/time_members.h
@@ -0,0 +1,94 @@
+// std::time_get, std::time_put implementation, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/time_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(size_t __refs) 
+    : facet(__refs), _M_data(0)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
+    : facet(__refs), _M_data(__cache)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, 
+				     size_t __refs) 
+    : facet(__refs), _M_data(0)
+    {
+      if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
+	{
+	  const size_t __len = __builtin_strlen(__s) + 1;
+	  char* __tmp = new char[__len];
+	  __builtin_memcpy(__tmp, __s, __len);
+	  _M_name_timepunct = __tmp;
+	}
+      else
+	_M_name_timepunct = _S_get_c_name();
+
+      __try
+	{ _M_initialize_timepunct(__cloc); }
+      __catch(...)
+	{
+	  if (_M_name_timepunct != _S_get_c_name())
+	    delete [] _M_name_timepunct;
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::~__timepunct()
+    { 
+      if (_M_name_timepunct != _S_get_c_name())
+	delete [] _M_name_timepunct;
+      delete _M_data;
+      _S_destroy_c_locale(_M_c_locale_timepunct); 
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_shared.so
new file mode 100755
index 0000000..69247e4
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_static.a
new file mode 100644
index 0000000..5fc3cf8
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libsupc++.a
new file mode 100644
index 0000000..4531f3f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/atomic_word.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/atomic_word.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/basic_file.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/basic_file.h
@@ -0,0 +1,111 @@
+// Wrapper of C-language FILE struct -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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  File-based streams
+//
+
+/** @file bits/basic_file.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
+#define _GLIBCXX_BASIC_FILE_STDIO_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/c++io.h>  // for __c_lock and __c_file
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Generic declaration.
+  template<typename _CharT>
+    class __basic_file; 
+
+  // Specialization.
+  template<>
+    class __basic_file<char>
+    {
+      // Underlying data source/sink.
+      __c_file* 	_M_cfile;
+
+      // True iff we opened _M_cfile, and thus must close it ourselves.
+      bool 		_M_cfile_created;
+
+    public:
+      __basic_file(__c_lock* __lock = 0) throw ();
+
+      __basic_file* 
+      open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
+
+      __basic_file*
+      sys_open(__c_file* __file, ios_base::openmode);
+
+      __basic_file*
+      sys_open(int __fd, ios_base::openmode __mode) throw ();
+
+      __basic_file* 
+      close(); 
+
+      _GLIBCXX_PURE bool 
+      is_open() const throw ();
+
+      _GLIBCXX_PURE int 
+      fd() throw ();
+
+      _GLIBCXX_PURE __c_file*
+      file() throw ();
+
+      ~__basic_file();
+
+      streamsize 
+      xsputn(const char* __s, streamsize __n);
+
+      streamsize 
+      xsputn_2(const char* __s1, streamsize __n1,
+	       const char* __s2, streamsize __n2);
+
+      streamsize 
+      xsgetn(char* __s, streamsize __n);
+
+      streamoff
+      seekoff(streamoff __off, ios_base::seekdir __way) throw ();
+
+      int 
+      sync();
+
+      streamsize
+      showmanyc();
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif	
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++allocator.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++allocator.h
@@ -0,0 +1,37 @@
+// Base to std::allocator -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++allocator.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{memory}
+ */
+
+#ifndef _GLIBCXX_CXX_ALLOCATOR_H
+#define _GLIBCXX_CXX_ALLOCATOR_H 1
+
+// Define new_allocator as the base class to std::allocator.
+#include <ext/new_allocator.h>
+#define __glibcxx_base_allocator  __gnu_cxx::new_allocator
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++config.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++config.h
new file mode 100644
index 0000000..2a2d1c2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++config.h
@@ -0,0 +1,1569 @@
+// Predefined symbols and macros -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++config.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#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__ 20120106
+
+// Macros for various attributes.
+//   _GLIBCXX_PURE
+//   _GLIBCXX_CONST
+//   _GLIBCXX_NORETURN
+//   _GLIBCXX_NOTHROW
+//   _GLIBCXX_VISIBILITY
+#ifndef _GLIBCXX_PURE
+# define _GLIBCXX_PURE __attribute__ ((__pure__))
+#endif
+
+#ifndef _GLIBCXX_CONST
+# define _GLIBCXX_CONST __attribute__ ((__const__))
+#endif
+
+#ifndef _GLIBCXX_NORETURN
+# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
+#endif
+
+#ifndef _GLIBCXX_NOTHROW
+# ifdef __cplusplus
+#  define _GLIBCXX_NOTHROW throw()
+# else
+#  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
+# endif
+#endif
+
+// Macros for visibility attributes.
+//   _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+//   _GLIBCXX_VISIBILITY
+# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1
+
+#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
+#else
+// If this is not supplied by the OS-specific or CPU-specific
+// headers included below, it will be defined to an empty default.
+# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
+#endif
+
+// Macros for deprecated attributes.
+//   _GLIBCXX_USE_DEPRECATED
+//   _GLIBCXX_DEPRECATED
+#ifndef _GLIBCXX_USE_DEPRECATED
+# define _GLIBCXX_USE_DEPRECATED 1
+#endif
+
+#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
+#else
+# define _GLIBCXX_DEPRECATED
+#endif
+
+#if __cplusplus
+
+// Macro for constexpr, to support in mixed 03/0x mode.
+#ifndef _GLIBCXX_CONSTEXPR
+# ifdef __GXX_EXPERIMENTAL_CXX0X__
+#  define _GLIBCXX_CONSTEXPR constexpr
+#  define _GLIBCXX_USE_CONSTEXPR constexpr
+# else
+#  define _GLIBCXX_CONSTEXPR
+#  define _GLIBCXX_USE_CONSTEXPR const
+# endif
+#endif
+
+// Macro for extern template, ie controling template linkage via use
+// of extern keyword on template declaration. As documented in the g++
+// manual, 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.
+// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
+// templates only in basic_string, thus activating its debug-mode
+// checks even at -O0.
+# define _GLIBCXX_EXTERN_TEMPLATE 1
+
+/*
+  Outline of libstdc++ namespaces.
+
+  namespace std
+  {
+    namespace __debug { }
+    namespace __parallel { }
+    namespace __profile { }
+    namespace __cxx1998 { }
+
+    namespace __detail { }
+
+    namespace rel_ops { }
+
+    namespace tr1
+    {
+      namespace placeholders { }
+      namespace regex_constants { }
+      namespace __detail { }
+    }
+
+    namespace decimal { }
+
+    namespace chrono { }
+    namespace placeholders { }
+    namespace regex_constants { }
+    namespace this_thread { }
+  }
+
+  namespace abi { }
+
+  namespace __gnu_cxx
+  {
+    namespace __detail { }
+  }
+
+  For full details see:
+  http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
+*/
+namespace std
+{
+  typedef __SIZE_TYPE__ 	size_t;
+  typedef __PTRDIFF_TYPE__	ptrdiff_t;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  typedef decltype(nullptr)	nullptr_t;
+#endif
+}
+
+
+// Defined if inline namespaces are used for versioning.
+# define _GLIBCXX_INLINE_VERSION 0 
+
+// Inline namespace for symbol versioning.
+#if _GLIBCXX_INLINE_VERSION
+
+namespace std
+{
+  inline namespace __7 { }
+
+  namespace rel_ops { inline namespace __7 { } }
+
+  namespace tr1
+  {
+    inline namespace __7 { }
+    namespace placeholders { inline namespace __7 { } }
+    namespace regex_constants { inline namespace __7 { } }
+    namespace __detail { inline namespace __7 { } }
+  }
+
+  namespace decimal { inline namespace __7 { } }
+
+  namespace chrono { inline namespace __7 { } }
+  namespace placeholders { inline namespace __7 { } }
+  namespace regex_constants { inline namespace __7 { } }
+  namespace this_thread { inline namespace __7 { } }
+
+  namespace __detail { inline namespace __7 { } }
+  namespace __regex { inline namespace __7 { } }
+}
+
+namespace __gnu_cxx
+{
+  inline namespace __7 { }
+  namespace __detail { inline namespace __7 { } }
+}
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 {
+# define _GLIBCXX_END_NAMESPACE_VERSION }
+#else
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+
+// Inline namespaces for special modes: debug, parallel, profile.
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
+    || defined(_GLIBCXX_PROFILE)
+namespace std
+{
+  // Non-inline namespace for components replaced by alternates in active mode.
+  namespace __cxx1998
+  {
+#if _GLIBCXX_INLINE_VERSION
+ inline namespace __7 { }
+#endif
+  }
+
+  // Inline namespace for debug mode.
+# ifdef _GLIBCXX_DEBUG
+  inline namespace __debug { }
+# endif
+
+  // Inline namespaces for parallel mode.
+# ifdef _GLIBCXX_PARALLEL
+  inline namespace __parallel { }
+# endif
+
+  // Inline namespaces for profile mode
+# ifdef _GLIBCXX_PROFILE
+  inline namespace __profile { }
+# endif
+}
+
+// Check for invalid usage and unsupported mixed-mode use.
+# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
+#  error illegal use of multiple inlined namespaces
+# endif
+# if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
+#  error illegal use of multiple inlined namespaces
+# endif
+
+// Check for invalid use due to lack for weak symbols.
+# if __NO_INLINE__ && !__GXX_WEAK__
+#  warning currently using inlined namespace mode which may fail \
+   without inlining due to lack of weak symbols
+# endif
+#endif
+
+// Macros for namespace scope. Either namespace std:: or the name
+// of some nested namespace within it corresponding to the active mode.
+// _GLIBCXX_STD_A
+// _GLIBCXX_STD_C
+//
+// Macros for opening/closing conditional namespaces.
+// _GLIBCXX_BEGIN_NAMESPACE_ALGO
+// _GLIBCXX_END_NAMESPACE_ALGO
+// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+// _GLIBCXX_END_NAMESPACE_CONTAINER
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
+# define _GLIBCXX_STD_C __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
+	 namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_CONTAINER \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+# undef _GLIBCXX_EXTERN_TEMPLATE
+#  define _GLIBCXX_EXTERN_TEMPLATE 1 -1
+#endif
+
+#ifdef _GLIBCXX_PARALLEL
+# define _GLIBCXX_STD_A __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
+	 namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+# define _GLIBCXX_END_NAMESPACE_ALGO \
+	 } _GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
+#ifndef _GLIBCXX_STD_A
+# define _GLIBCXX_STD_A std
+#endif
+
+#ifndef _GLIBCXX_STD_C
+# define _GLIBCXX_STD_C std
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO
+# define _GLIBCXX_BEGIN_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_ALGO
+# define _GLIBCXX_END_NAMESPACE_ALGO
+#endif
+
+#ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
+#endif
+
+#ifndef _GLIBCXX_END_NAMESPACE_CONTAINER
+# define _GLIBCXX_END_NAMESPACE_CONTAINER
+#endif
+
+// GLIBCXX_ABI Deprecated
+// Define if compatibility should be provided for -mlong-double-64.
+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+// Inline namespace for long double 128 mode.
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+namespace std
+{
+  inline namespace __gnu_cxx_ldbl128 { }
+}
+# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
+# define _GLIBCXX_END_NAMESPACE_LDBL }
+#else
+# define _GLIBCXX_NAMESPACE_LDBL
+# define _GLIBCXX_BEGIN_NAMESPACE_LDBL
+# define _GLIBCXX_END_NAMESPACE_LDBL
+#endif
+
+// Assert.
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
+# define __glibcxx_assert(_Condition)
+#else
+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();
+  }
+}
+#define __glibcxx_assert(_Condition)				   	 \
+  do 									 \
+  {							      		 \
+    if (! (_Condition))                                                  \
+      std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+				#_Condition);				 \
+  } while (false)
+#endif
+
+// Macros for race detectors.
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
+// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
+// atomic (lock-free) synchronization to race detectors:
+// the race detector will infer a happens-before arc from the former to the
+// latter when they share the same argument pointer.
+//
+// The most frequent use case for these macros (and the only case in the
+// current implementation of the library) is atomic reference counting:
+//   void _M_remove_reference()
+//   {
+//     _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
+//     if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
+//       {
+//         _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
+//         _M_destroy(__a);
+//       }
+//   }
+// The annotations in this example tell the race detector that all memory
+// accesses occurred when the refcount was positive do not race with
+// memory accesses which occurred after the refcount became zero.
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
+#endif
+#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
+# define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
+#endif
+
+// Macros for C linkage: define extern "C" linkage only when using C++.
+# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
+# define _GLIBCXX_END_EXTERN_C }
+
+#else // !__cplusplus
+# 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>
+
+// If platform uses neither visibility nor psuedo-visibility,
+// specify empty default for namespace annotation macros.
+#ifndef _GLIBCXX_PSEUDO_VISIBILITY
+# define _GLIBCXX_PSEUDO_VISIBILITY(V)
+#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
+
+
+// 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 settings discovered at configure time follow.
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `acosf' function. */
+/* #undef _GLIBCXX_HAVE_ACOSF */
+
+/* Define to 1 if you have the `acosl' function. */
+/* #undef _GLIBCXX_HAVE_ACOSL */
+
+/* Define to 1 if you have the `asinf' function. */
+/* #undef _GLIBCXX_HAVE_ASINF */
+
+/* Define to 1 if you have the `asinl' function. */
+/* #undef _GLIBCXX_HAVE_ASINL */
+
+/* Define to 1 if the target assembler supports .symver directive. */
+#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1
+
+/* Define to 1 if you have the `atan2f' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2F */
+
+/* Define to 1 if you have the `atan2l' function. */
+/* #undef _GLIBCXX_HAVE_ATAN2L */
+
+/* Define to 1 if you have the `atanf' function. */
+/* #undef _GLIBCXX_HAVE_ATANF */
+
+/* Define to 1 if you have the `atanl' function. */
+/* #undef _GLIBCXX_HAVE_ATANL */
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_CC_TLS */
+
+/* Define to 1 if you have the `ceilf' function. */
+/* #undef _GLIBCXX_HAVE_CEILF */
+
+/* Define to 1 if you have the `ceill' function. */
+/* #undef _GLIBCXX_HAVE_CEILL */
+
+/* Define to 1 if you have the <complex.h> header file. */
+/* #undef _GLIBCXX_HAVE_COMPLEX_H */
+
+/* Define to 1 if you have the `cosf' function. */
+/* #undef _GLIBCXX_HAVE_COSF */
+
+/* Define to 1 if you have the `coshf' function. */
+/* #undef _GLIBCXX_HAVE_COSHF */
+
+/* Define to 1 if you have the `coshl' function. */
+/* #undef _GLIBCXX_HAVE_COSHL */
+
+/* Define to 1 if you have the `cosl' function. */
+/* #undef _GLIBCXX_HAVE_COSL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _GLIBCXX_HAVE_DLFCN_H 1
+
+/* Define if EBADMSG exists. */
+#define _GLIBCXX_HAVE_EBADMSG 1
+
+/* Define if ECANCELED exists. */
+#define _GLIBCXX_HAVE_ECANCELED 1
+
+/* Define if EIDRM exists. */
+#define _GLIBCXX_HAVE_EIDRM 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define _GLIBCXX_HAVE_ENDIAN_H 1
+
+/* Define if ENODATA exists. */
+#define _GLIBCXX_HAVE_ENODATA 1
+
+/* Define if ENOLINK exists. */
+#define _GLIBCXX_HAVE_ENOLINK 1
+
+/* Define if ENOSR exists. */
+#define _GLIBCXX_HAVE_ENOSR 1
+
+/* Define if ENOSTR exists. */
+#define _GLIBCXX_HAVE_ENOSTR 1
+
+/* Define if ENOTRECOVERABLE exists. */
+#define _GLIBCXX_HAVE_ENOTRECOVERABLE 1
+
+/* Define if ENOTSUP exists. */
+#define _GLIBCXX_HAVE_ENOTSUP 1
+
+/* Define if EOVERFLOW exists. */
+#define _GLIBCXX_HAVE_EOVERFLOW 1
+
+/* Define if EOWNERDEAD exists. */
+#define _GLIBCXX_HAVE_EOWNERDEAD 1
+
+/* Define if EPROTO exists. */
+#define _GLIBCXX_HAVE_EPROTO 1
+
+/* Define if ETIME exists. */
+#define _GLIBCXX_HAVE_ETIME 1
+
+/* Define if ETXTBSY exists. */
+#define _GLIBCXX_HAVE_ETXTBSY 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+/* #undef _GLIBCXX_HAVE_EXECINFO_H */
+
+/* Define to 1 if you have the `expf' function. */
+/* #undef _GLIBCXX_HAVE_EXPF */
+
+/* Define to 1 if you have the `expl' function. */
+/* #undef _GLIBCXX_HAVE_EXPL */
+
+/* Define to 1 if you have the `fabsf' function. */
+/* #undef _GLIBCXX_HAVE_FABSF */
+
+/* Define to 1 if you have the `fabsl' function. */
+/* #undef _GLIBCXX_HAVE_FABSL */
+
+/* Define to 1 if you have the <fenv.h> header file. */
+#define _GLIBCXX_HAVE_FENV_H 1
+
+/* Define to 1 if you have the `finite' function. */
+/* #undef _GLIBCXX_HAVE_FINITE */
+
+/* Define to 1 if you have the `finitef' function. */
+/* #undef _GLIBCXX_HAVE_FINITEF */
+
+/* Define to 1 if you have the `finitel' function. */
+/* #undef _GLIBCXX_HAVE_FINITEL */
+
+/* Define to 1 if you have the <float.h> header file. */
+#define _GLIBCXX_HAVE_FLOAT_H 1
+
+/* Define to 1 if you have the `floorf' function. */
+/* #undef _GLIBCXX_HAVE_FLOORF */
+
+/* Define to 1 if you have the `floorl' function. */
+/* #undef _GLIBCXX_HAVE_FLOORL */
+
+/* Define to 1 if you have the `fmodf' function. */
+/* #undef _GLIBCXX_HAVE_FMODF */
+
+/* Define to 1 if you have the `fmodl' function. */
+/* #undef _GLIBCXX_HAVE_FMODL */
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef _GLIBCXX_HAVE_FPCLASS */
+
+/* Define to 1 if you have the <fp.h> header file. */
+/* #undef _GLIBCXX_HAVE_FP_H */
+
+/* Define to 1 if you have the `frexpf' function. */
+/* #undef _GLIBCXX_HAVE_FREXPF */
+
+/* Define to 1 if you have the `frexpl' function. */
+/* #undef _GLIBCXX_HAVE_FREXPL */
+
+/* Define if _Unwind_GetIPInfo is available. */
+#define _GLIBCXX_HAVE_GETIPINFO 1
+
+/* Define if gthr-default.h exists (meaning that threading support is
+   enabled). */
+#define _GLIBCXX_HAVE_GTHR_DEFAULT 1
+
+/* Define to 1 if you have the `hypot' function. */
+/* #undef _GLIBCXX_HAVE_HYPOT */
+
+/* Define to 1 if you have the `hypotf' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTF */
+
+/* Define to 1 if you have the `hypotl' function. */
+/* #undef _GLIBCXX_HAVE_HYPOTL */
+
+/* Define if you have the iconv() function. */
+/* #undef _GLIBCXX_HAVE_ICONV */
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef _GLIBCXX_HAVE_IEEEFP_H */
+
+/* Define if int64_t is available in <stdint.h>. */
+#define _GLIBCXX_HAVE_INT64_T 1
+
+/* Define if int64_t is a long. */
+/* #undef _GLIBCXX_HAVE_INT64_T_LONG */
+
+/* Define if int64_t is a long long. */
+#define _GLIBCXX_HAVE_INT64_T_LONG_LONG 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _GLIBCXX_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isinf' function. */
+/* #undef _GLIBCXX_HAVE_ISINF */
+
+/* Define to 1 if you have the `isinff' function. */
+/* #undef _GLIBCXX_HAVE_ISINFF */
+
+/* Define to 1 if you have the `isinfl' function. */
+/* #undef _GLIBCXX_HAVE_ISINFL */
+
+/* Define to 1 if you have the `isnan' function. */
+/* #undef _GLIBCXX_HAVE_ISNAN */
+
+/* Define to 1 if you have the `isnanf' function. */
+/* #undef _GLIBCXX_HAVE_ISNANF */
+
+/* Define to 1 if you have the `isnanl' function. */
+/* #undef _GLIBCXX_HAVE_ISNANL */
+
+/* Defined if iswblank exists. */
+/* #undef _GLIBCXX_HAVE_ISWBLANK */
+
+/* Define if LC_MESSAGES is available in <locale.h>. */
+#define _GLIBCXX_HAVE_LC_MESSAGES 1
+
+/* Define to 1 if you have the `ldexpf' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPF */
+
+/* Define to 1 if you have the `ldexpl' function. */
+/* #undef _GLIBCXX_HAVE_LDEXPL */
+
+/* Define to 1 if you have the <libintl.h> header file. */
+/* #undef _GLIBCXX_HAVE_LIBINTL_H */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_AS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_DATA */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_FSIZE */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_RSS */
+
+/* Only used in build directory testsuite_hooks.h. */
+/* #undef _GLIBCXX_HAVE_LIMIT_VMEM */
+
+/* Define if futex syscall is available. */
+/* #undef _GLIBCXX_HAVE_LINUX_FUTEX */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define _GLIBCXX_HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `log10f' function. */
+/* #undef _GLIBCXX_HAVE_LOG10F */
+
+/* Define to 1 if you have the `log10l' function. */
+/* #undef _GLIBCXX_HAVE_LOG10L */
+
+/* Define to 1 if you have the `logf' function. */
+/* #undef _GLIBCXX_HAVE_LOGF */
+
+/* Define to 1 if you have the `logl' function. */
+/* #undef _GLIBCXX_HAVE_LOGL */
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */
+
+/* Define to 1 if you have the <machine/param.h> header file. */
+/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */
+
+/* Define if mbstate_t exists in wchar.h. */
+#define _GLIBCXX_HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _GLIBCXX_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `modf' function. */
+/* #undef _GLIBCXX_HAVE_MODF */
+
+/* Define to 1 if you have the `modff' function. */
+/* #undef _GLIBCXX_HAVE_MODFF */
+
+/* Define to 1 if you have the `modfl' function. */
+/* #undef _GLIBCXX_HAVE_MODFL */
+
+/* Define to 1 if you have the <nan.h> header file. */
+/* #undef _GLIBCXX_HAVE_NAN_H */
+
+/* Define if poll is available in <poll.h>. */
+/* #undef _GLIBCXX_HAVE_POLL */
+
+/* Define to 1 if you have the `powf' function. */
+/* #undef _GLIBCXX_HAVE_POWF */
+
+/* Define to 1 if you have the `powl' function. */
+/* #undef _GLIBCXX_HAVE_POWL */
+
+/* Define to 1 if you have the `qfpclass' function. */
+/* #undef _GLIBCXX_HAVE_QFPCLASS */
+
+/* Define to 1 if you have the `setenv' function. */
+/* #undef _GLIBCXX_HAVE_SETENV */
+
+/* Define to 1 if you have the `sincos' function. */
+/* #undef _GLIBCXX_HAVE_SINCOS */
+
+/* Define to 1 if you have the `sincosf' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSF */
+
+/* Define to 1 if you have the `sincosl' function. */
+/* #undef _GLIBCXX_HAVE_SINCOSL */
+
+/* Define to 1 if you have the `sinf' function. */
+/* #undef _GLIBCXX_HAVE_SINF */
+
+/* Define to 1 if you have the `sinhf' function. */
+/* #undef _GLIBCXX_HAVE_SINHF */
+
+/* Define to 1 if you have the `sinhl' function. */
+/* #undef _GLIBCXX_HAVE_SINHL */
+
+/* Define to 1 if you have the `sinl' function. */
+/* #undef _GLIBCXX_HAVE_SINL */
+
+/* Define to 1 if you have the `sqrtf' function. */
+/* #undef _GLIBCXX_HAVE_SQRTF */
+
+/* Define to 1 if you have the `sqrtl' function. */
+/* #undef _GLIBCXX_HAVE_SQRTL */
+
+/* Define to 1 if you have the <stdbool.h> header file. */
+#define _GLIBCXX_HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _GLIBCXX_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _GLIBCXX_HAVE_STDLIB_H 1
+
+/* Define if strerror_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRERROR_L */
+
+/* Define if strerror_r is available in <string.h>. */
+#define _GLIBCXX_HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _GLIBCXX_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _GLIBCXX_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtof' function. */
+/* #undef _GLIBCXX_HAVE_STRTOF */
+
+/* Define to 1 if you have the `strtold' function. */
+/* #undef _GLIBCXX_HAVE_STRTOLD */
+
+/* Define if strxfrm_l is available in <string.h>. */
+/* #undef _GLIBCXX_HAVE_STRXFRM_L */
+
+/* Define to 1 if the target runtime linker supports binding the same symbol
+   to different versions. */
+/* #undef _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT */
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/ipc.h> header file. */
+#define _GLIBCXX_HAVE_SYS_IPC_H 1
+
+/* Define to 1 if you have the <sys/isa_defs.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
+
+/* Define to 1 if you have the <sys/machine.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _GLIBCXX_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/sem.h> header file. */
+/* #undef _GLIBCXX_HAVE_SYS_SEM_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _GLIBCXX_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _GLIBCXX_HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define _GLIBCXX_HAVE_SYS_UIO_H 1
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_IFREG */
+
+/* Define if S_IFREG is available in <sys/stat.h>. */
+/* #undef _GLIBCXX_HAVE_S_ISREG */
+
+/* Define to 1 if you have the `tanf' function. */
+/* #undef _GLIBCXX_HAVE_TANF */
+
+/* Define to 1 if you have the `tanhf' function. */
+/* #undef _GLIBCXX_HAVE_TANHF */
+
+/* Define to 1 if you have the `tanhl' function. */
+/* #undef _GLIBCXX_HAVE_TANHL */
+
+/* Define to 1 if you have the `tanl' function. */
+/* #undef _GLIBCXX_HAVE_TANL */
+
+/* Define to 1 if you have the <tgmath.h> header file. */
+/* #undef _GLIBCXX_HAVE_TGMATH_H */
+
+/* Define to 1 if the target supports thread-local storage. */
+/* #undef _GLIBCXX_HAVE_TLS */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _GLIBCXX_HAVE_UNISTD_H 1
+
+/* Defined if vfwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VFWSCANF */
+
+/* Defined if vswscanf exists. */
+/* #undef _GLIBCXX_HAVE_VSWSCANF */
+
+/* Defined if vwscanf exists. */
+/* #undef _GLIBCXX_HAVE_VWSCANF */
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define _GLIBCXX_HAVE_WCHAR_H 1
+
+/* Defined if wcstof exists. */
+/* #undef _GLIBCXX_HAVE_WCSTOF */
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define _GLIBCXX_HAVE_WCTYPE_H 1
+
+/* Define if writev is available in <sys/uio.h>. */
+/* #undef _GLIBCXX_HAVE_WRITEV */
+
+/* Define to 1 if you have the `_acosf' function. */
+/* #undef _GLIBCXX_HAVE__ACOSF */
+
+/* Define to 1 if you have the `_acosl' function. */
+/* #undef _GLIBCXX_HAVE__ACOSL */
+
+/* Define to 1 if you have the `_asinf' function. */
+/* #undef _GLIBCXX_HAVE__ASINF */
+
+/* Define to 1 if you have the `_asinl' function. */
+/* #undef _GLIBCXX_HAVE__ASINL */
+
+/* Define to 1 if you have the `_atan2f' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2F */
+
+/* Define to 1 if you have the `_atan2l' function. */
+/* #undef _GLIBCXX_HAVE__ATAN2L */
+
+/* Define to 1 if you have the `_atanf' function. */
+/* #undef _GLIBCXX_HAVE__ATANF */
+
+/* Define to 1 if you have the `_atanl' function. */
+/* #undef _GLIBCXX_HAVE__ATANL */
+
+/* Define to 1 if you have the `_ceilf' function. */
+/* #undef _GLIBCXX_HAVE__CEILF */
+
+/* Define to 1 if you have the `_ceill' function. */
+/* #undef _GLIBCXX_HAVE__CEILL */
+
+/* Define to 1 if you have the `_cosf' function. */
+/* #undef _GLIBCXX_HAVE__COSF */
+
+/* Define to 1 if you have the `_coshf' function. */
+/* #undef _GLIBCXX_HAVE__COSHF */
+
+/* Define to 1 if you have the `_coshl' function. */
+/* #undef _GLIBCXX_HAVE__COSHL */
+
+/* Define to 1 if you have the `_cosl' function. */
+/* #undef _GLIBCXX_HAVE__COSL */
+
+/* Define to 1 if you have the `_expf' function. */
+/* #undef _GLIBCXX_HAVE__EXPF */
+
+/* Define to 1 if you have the `_expl' function. */
+/* #undef _GLIBCXX_HAVE__EXPL */
+
+/* Define to 1 if you have the `_fabsf' function. */
+/* #undef _GLIBCXX_HAVE__FABSF */
+
+/* Define to 1 if you have the `_fabsl' function. */
+/* #undef _GLIBCXX_HAVE__FABSL */
+
+/* Define to 1 if you have the `_finite' function. */
+/* #undef _GLIBCXX_HAVE__FINITE */
+
+/* Define to 1 if you have the `_finitef' function. */
+/* #undef _GLIBCXX_HAVE__FINITEF */
+
+/* Define to 1 if you have the `_finitel' function. */
+/* #undef _GLIBCXX_HAVE__FINITEL */
+
+/* Define to 1 if you have the `_floorf' function. */
+/* #undef _GLIBCXX_HAVE__FLOORF */
+
+/* Define to 1 if you have the `_floorl' function. */
+/* #undef _GLIBCXX_HAVE__FLOORL */
+
+/* Define to 1 if you have the `_fmodf' function. */
+/* #undef _GLIBCXX_HAVE__FMODF */
+
+/* Define to 1 if you have the `_fmodl' function. */
+/* #undef _GLIBCXX_HAVE__FMODL */
+
+/* Define to 1 if you have the `_fpclass' function. */
+/* #undef _GLIBCXX_HAVE__FPCLASS */
+
+/* Define to 1 if you have the `_frexpf' function. */
+/* #undef _GLIBCXX_HAVE__FREXPF */
+
+/* Define to 1 if you have the `_frexpl' function. */
+/* #undef _GLIBCXX_HAVE__FREXPL */
+
+/* Define to 1 if you have the `_hypot' function. */
+/* #undef _GLIBCXX_HAVE__HYPOT */
+
+/* Define to 1 if you have the `_hypotf' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTF */
+
+/* Define to 1 if you have the `_hypotl' function. */
+/* #undef _GLIBCXX_HAVE__HYPOTL */
+
+/* Define to 1 if you have the `_isinf' function. */
+/* #undef _GLIBCXX_HAVE__ISINF */
+
+/* Define to 1 if you have the `_isinff' function. */
+/* #undef _GLIBCXX_HAVE__ISINFF */
+
+/* Define to 1 if you have the `_isinfl' function. */
+/* #undef _GLIBCXX_HAVE__ISINFL */
+
+/* Define to 1 if you have the `_isnan' function. */
+/* #undef _GLIBCXX_HAVE__ISNAN */
+
+/* Define to 1 if you have the `_isnanf' function. */
+/* #undef _GLIBCXX_HAVE__ISNANF */
+
+/* Define to 1 if you have the `_isnanl' function. */
+/* #undef _GLIBCXX_HAVE__ISNANL */
+
+/* Define to 1 if you have the `_ldexpf' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPF */
+
+/* Define to 1 if you have the `_ldexpl' function. */
+/* #undef _GLIBCXX_HAVE__LDEXPL */
+
+/* Define to 1 if you have the `_log10f' function. */
+/* #undef _GLIBCXX_HAVE__LOG10F */
+
+/* Define to 1 if you have the `_log10l' function. */
+/* #undef _GLIBCXX_HAVE__LOG10L */
+
+/* Define to 1 if you have the `_logf' function. */
+/* #undef _GLIBCXX_HAVE__LOGF */
+
+/* Define to 1 if you have the `_logl' function. */
+/* #undef _GLIBCXX_HAVE__LOGL */
+
+/* Define to 1 if you have the `_modf' function. */
+/* #undef _GLIBCXX_HAVE__MODF */
+
+/* Define to 1 if you have the `_modff' function. */
+/* #undef _GLIBCXX_HAVE__MODFF */
+
+/* Define to 1 if you have the `_modfl' function. */
+/* #undef _GLIBCXX_HAVE__MODFL */
+
+/* Define to 1 if you have the `_powf' function. */
+/* #undef _GLIBCXX_HAVE__POWF */
+
+/* Define to 1 if you have the `_powl' function. */
+/* #undef _GLIBCXX_HAVE__POWL */
+
+/* Define to 1 if you have the `_qfpclass' function. */
+/* #undef _GLIBCXX_HAVE__QFPCLASS */
+
+/* Define to 1 if you have the `_sincos' function. */
+/* #undef _GLIBCXX_HAVE__SINCOS */
+
+/* Define to 1 if you have the `_sincosf' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSF */
+
+/* Define to 1 if you have the `_sincosl' function. */
+/* #undef _GLIBCXX_HAVE__SINCOSL */
+
+/* Define to 1 if you have the `_sinf' function. */
+/* #undef _GLIBCXX_HAVE__SINF */
+
+/* Define to 1 if you have the `_sinhf' function. */
+/* #undef _GLIBCXX_HAVE__SINHF */
+
+/* Define to 1 if you have the `_sinhl' function. */
+/* #undef _GLIBCXX_HAVE__SINHL */
+
+/* Define to 1 if you have the `_sinl' function. */
+/* #undef _GLIBCXX_HAVE__SINL */
+
+/* Define to 1 if you have the `_sqrtf' function. */
+/* #undef _GLIBCXX_HAVE__SQRTF */
+
+/* Define to 1 if you have the `_sqrtl' function. */
+/* #undef _GLIBCXX_HAVE__SQRTL */
+
+/* Define to 1 if you have the `_tanf' function. */
+/* #undef _GLIBCXX_HAVE__TANF */
+
+/* Define to 1 if you have the `_tanhf' function. */
+/* #undef _GLIBCXX_HAVE__TANHF */
+
+/* Define to 1 if you have the `_tanhl' function. */
+/* #undef _GLIBCXX_HAVE__TANHL */
+
+/* Define to 1 if you have the `_tanl' function. */
+/* #undef _GLIBCXX_HAVE__TANL */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef _GLIBCXX_ICONV_CONST */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+/* #undef _GLIBCXX_PACKAGE */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _GLIBCXX_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _GLIBCXX_PACKAGE_NAME "package-unused"
+
+/* Define to the full name and version of this package. */
+#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused"
+
+/* Define to the one symbol short name of this package. */
+#define _GLIBCXX_PACKAGE_TARNAME "libstdc++"
+
+/* Define to the home page for this package. */
+#define _GLIBCXX_PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused"
+
+/* The size of `char', as computed by sizeof. */
+/* #undef SIZEOF_CHAR */
+
+/* The size of `int', as computed by sizeof. */
+/* #undef SIZEOF_INT */
+
+/* The size of `long', as computed by sizeof. */
+/* #undef SIZEOF_LONG */
+
+/* The size of `short', as computed by sizeof. */
+/* #undef SIZEOF_SHORT */
+
+/* The size of `void *', as computed by sizeof. */
+/* #undef SIZEOF_VOID_P */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+/* #undef _GLIBCXX_VERSION */
+
+/* Define if builtin atomic operations for bool are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+
+/* Define if builtin atomic operations for short are supported on this host.
+   */
+#define _GLIBCXX_ATOMIC_BUILTINS_2 1
+
+/* Define if builtin atomic operations for int are supported on this host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_4 1
+
+/* Define if builtin atomic operations for long long are supported on this
+   host. */
+#define _GLIBCXX_ATOMIC_BUILTINS_8 1
+
+/* Define to use concept checking code from the boost libraries. */
+/* #undef _GLIBCXX_CONCEPT_CHECKS */
+
+/* Define if a fully dynamic basic_string is wanted. */
+/* #undef _GLIBCXX_FULLY_DYNAMIC_STRING */
+
+/* Define if gthreads library is available. */
+/* #undef _GLIBCXX_HAS_GTHREADS */
+
+/* Define to 1 if a full hosted library is built, or 0 if freestanding. */
+#define _GLIBCXX_HOSTED 1
+
+/* Define if compatibility should be provided for -mlong-double-64. */
+
+/* Define if ptrdiff_t is int. */
+#define _GLIBCXX_PTRDIFF_T_IS_INT 1
+
+/* Define if using setrlimit to set resource limits during "make check" */
+/* #undef _GLIBCXX_RES_LIMITS */
+
+/* Define if size_t is unsigned int. */
+#define _GLIBCXX_SIZE_T_IS_UINT 1
+
+/* Define if the compiler is configured for setjmp/longjmp exceptions. */
+/* #undef _GLIBCXX_SJLJ_EXCEPTIONS */
+
+/* Define to the value of the EOF integer constant. */
+#define _GLIBCXX_STDIO_EOF -1
+
+/* Define to the value of the SEEK_CUR integer constant. */
+#define _GLIBCXX_STDIO_SEEK_CUR 1
+
+/* Define to the value of the SEEK_END integer constant. */
+#define _GLIBCXX_STDIO_SEEK_END 2
+
+/* Define to use symbol versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER */
+
+/* Define to use darwin versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_DARWIN */
+
+/* Define to use GNU versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU */
+
+/* Define to use GNU namespace versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */
+
+/* Define to use Sun versioning in the shared library. */
+/* #undef _GLIBCXX_SYMVER_SUN */
+
+/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
+   <stdio.h>, and <stdlib.h> can be used or exposed. */
+/* #undef _GLIBCXX_USE_C99 */
+
+/* Define if C99 functions in <complex.h> should be used in <complex>. Using
+   compiler builtins for these functions requires corresponding C99 library
+   functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX */
+
+/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
+   Using compiler builtins for these functions requires corresponding C99
+   library functions to be present. */
+/* #undef _GLIBCXX_USE_C99_COMPLEX_TR1 */
+
+/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_CTYPE_TR1 1
+
+/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_FENV_TR1 1
+
+/* Define if C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
+
+/* Define if wchar_t C99 functions in <inttypes.h> should be imported in
+   <tr1/cinttypes> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 */
+
+/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
+   in namespace std. */
+/* #undef _GLIBCXX_USE_C99_MATH */
+
+/* Define if C99 functions or macros in <math.h> should be imported in
+   <tr1/cmath> in namespace std::tr1. */
+/* #undef _GLIBCXX_USE_C99_MATH_TR1 */
+
+/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
+   namespace std::tr1. */
+#define _GLIBCXX_USE_C99_STDINT_TR1 1
+
+/* Defined if clock_gettime has monotonic clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_MONOTONIC */
+
+/* Defined if clock_gettime has realtime clock support. */
+/* #undef _GLIBCXX_USE_CLOCK_REALTIME */
+
+/* Define if ISO/IEC TR 24733 decimal floating point types are supported on
+   this host. */
+#define _GLIBCXX_USE_DECIMAL_FLOAT 1
+
+/* Defined if gettimeofday is available. */
+/* #undef _GLIBCXX_USE_GETTIMEOFDAY */
+
+/* Define if LFS support is available. */
+/* #undef _GLIBCXX_USE_LFS */
+
+/* Define if code specialized for long long should be used. */
+#define _GLIBCXX_USE_LONG_LONG 1
+
+/* Defined if nanosleep is available. */
+/* #undef _GLIBCXX_USE_NANOSLEEP */
+
+/* Define if NLS translations are to be used. */
+/* #undef _GLIBCXX_USE_NLS */
+
+/* Define if /dev/random and /dev/urandom are available for the random_device
+   of TR1 (Chapter 5.1). */
+#define _GLIBCXX_USE_RANDOM_TR1 1
+
+/* Defined if sched_yield is available. */
+/* #undef _GLIBCXX_USE_SCHED_YIELD */
+
+/* Define if code specialized for wchar_t should be used. */
+#define _GLIBCXX_USE_WCHAR_T 1
+
+#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
+# define _GLIBCXX_HAVE_ACOSF 1
+# define acosf _acosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)
+# define _GLIBCXX_HAVE_ACOSL 1
+# define acosl _acosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)
+# define _GLIBCXX_HAVE_ASINF 1
+# define asinf _asinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)
+# define _GLIBCXX_HAVE_ASINL 1
+# define asinl _asinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)
+# define _GLIBCXX_HAVE_ATAN2F 1
+# define atan2f _atan2f
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)
+# define _GLIBCXX_HAVE_ATAN2L 1
+# define atan2l _atan2l
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)
+# define _GLIBCXX_HAVE_ATANF 1
+# define atanf _atanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)
+# define _GLIBCXX_HAVE_ATANL 1
+# define atanl _atanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)
+# define _GLIBCXX_HAVE_CEILF 1
+# define ceilf _ceilf
+#endif
+
+#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)
+# define _GLIBCXX_HAVE_CEILL 1
+# define ceill _ceill
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)
+# define _GLIBCXX_HAVE_COSF 1
+# define cosf _cosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)
+# define _GLIBCXX_HAVE_COSHF 1
+# define coshf _coshf
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)
+# define _GLIBCXX_HAVE_COSHL 1
+# define coshl _coshl
+#endif
+
+#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)
+# define _GLIBCXX_HAVE_COSL 1
+# define cosl _cosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)
+# define _GLIBCXX_HAVE_EXPF 1
+# define expf _expf
+#endif
+
+#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)
+# define _GLIBCXX_HAVE_EXPL 1
+# define expl _expl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)
+# define _GLIBCXX_HAVE_FABSF 1
+# define fabsf _fabsf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)
+# define _GLIBCXX_HAVE_FABSL 1
+# define fabsl _fabsl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)
+# define _GLIBCXX_HAVE_FINITE 1
+# define finite _finite
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)
+# define _GLIBCXX_HAVE_FINITEF 1
+# define finitef _finitef
+#endif
+
+#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)
+# define _GLIBCXX_HAVE_FINITEL 1
+# define finitel _finitel
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)
+# define _GLIBCXX_HAVE_FLOORF 1
+# define floorf _floorf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)
+# define _GLIBCXX_HAVE_FLOORL 1
+# define floorl _floorl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)
+# define _GLIBCXX_HAVE_FMODF 1
+# define fmodf _fmodf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)
+# define _GLIBCXX_HAVE_FMODL 1
+# define fmodl _fmodl
+#endif
+
+#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)
+# define _GLIBCXX_HAVE_FPCLASS 1
+# define fpclass _fpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)
+# define _GLIBCXX_HAVE_FREXPF 1
+# define frexpf _frexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)
+# define _GLIBCXX_HAVE_FREXPL 1
+# define frexpl _frexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)
+# define _GLIBCXX_HAVE_HYPOT 1
+# define hypot _hypot
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)
+# define _GLIBCXX_HAVE_HYPOTF 1
+# define hypotf _hypotf
+#endif
+
+#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)
+# define _GLIBCXX_HAVE_HYPOTL 1
+# define hypotl _hypotl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)
+# define _GLIBCXX_HAVE_ISINF 1
+# define isinf _isinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)
+# define _GLIBCXX_HAVE_ISINFF 1
+# define isinff _isinff
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)
+# define _GLIBCXX_HAVE_ISINFL 1
+# define isinfl _isinfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)
+# define _GLIBCXX_HAVE_ISNAN 1
+# define isnan _isnan
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)
+# define _GLIBCXX_HAVE_ISNANF 1
+# define isnanf _isnanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)
+# define _GLIBCXX_HAVE_ISNANL 1
+# define isnanl _isnanl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)
+# define _GLIBCXX_HAVE_LDEXPF 1
+# define ldexpf _ldexpf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)
+# define _GLIBCXX_HAVE_LDEXPL 1
+# define ldexpl _ldexpl
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)
+# define _GLIBCXX_HAVE_LOG10F 1
+# define log10f _log10f
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)
+# define _GLIBCXX_HAVE_LOG10L 1
+# define log10l _log10l
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)
+# define _GLIBCXX_HAVE_LOGF 1
+# define logf _logf
+#endif
+
+#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)
+# define _GLIBCXX_HAVE_LOGL 1
+# define logl _logl
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)
+# define _GLIBCXX_HAVE_MODF 1
+# define modf _modf
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)
+# define _GLIBCXX_HAVE_MODFF 1
+# define modff _modff
+#endif
+
+#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)
+# define _GLIBCXX_HAVE_MODFL 1
+# define modfl _modfl
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)
+# define _GLIBCXX_HAVE_POWF 1
+# define powf _powf
+#endif
+
+#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)
+# define _GLIBCXX_HAVE_POWL 1
+# define powl _powl
+#endif
+
+#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)
+# define _GLIBCXX_HAVE_QFPCLASS 1
+# define qfpclass _qfpclass
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)
+# define _GLIBCXX_HAVE_SINCOS 1
+# define sincos _sincos
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)
+# define _GLIBCXX_HAVE_SINCOSF 1
+# define sincosf _sincosf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)
+# define _GLIBCXX_HAVE_SINCOSL 1
+# define sincosl _sincosl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)
+# define _GLIBCXX_HAVE_SINF 1
+# define sinf _sinf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)
+# define _GLIBCXX_HAVE_SINHF 1
+# define sinhf _sinhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)
+# define _GLIBCXX_HAVE_SINHL 1
+# define sinhl _sinhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)
+# define _GLIBCXX_HAVE_SINL 1
+# define sinl _sinl
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)
+# define _GLIBCXX_HAVE_SQRTF 1
+# define sqrtf _sqrtf
+#endif
+
+#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)
+# define _GLIBCXX_HAVE_SQRTL 1
+# define sqrtl _sqrtl
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)
+# define _GLIBCXX_HAVE_STRTOF 1
+# define strtof _strtof
+#endif
+
+#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)
+# define _GLIBCXX_HAVE_STRTOLD 1
+# define strtold _strtold
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)
+# define _GLIBCXX_HAVE_TANF 1
+# define tanf _tanf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)
+# define _GLIBCXX_HAVE_TANHF 1
+# define tanhf _tanhf
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)
+# define _GLIBCXX_HAVE_TANHL 1
+# define tanhl _tanhl
+#endif
+
+#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)
+# define _GLIBCXX_HAVE_TANL 1
+# define tanl _tanl
+#endif
+
+#endif // _GLIBCXX_CXX_CONFIG_H
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++io.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++io.h
@@ -0,0 +1,51 @@
+// Underlying io library details -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++io.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{ios}
+ */
+
+// c_io_stdio.h - Defines for using "C" stdio.h
+
+#ifndef _GLIBCXX_CXX_IO_H
+#define _GLIBCXX_CXX_IO_H 1
+
+#include <cstdio>
+#include <bits/gthr.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef __gthread_mutex_t __c_lock;
+
+  // for basic_file.h
+  typedef FILE __c_file;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++locale.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++locale.h
@@ -0,0 +1,93 @@
+// Wrapper for underlying C-language localization -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/c++locale.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.8  Standard locale categories.
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#ifndef _GLIBCXX_CXX_LOCALE_H
+#define _GLIBCXX_CXX_LOCALE_H 1
+
+#pragma GCC system_header
+
+#include <clocale>
+
+#define _GLIBCXX_NUM_CATEGORIES 0
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  typedef int*			__c_locale;
+
+  // Convert numeric value of type double and long double to string and
+  // return length of string.  If vsnprintf is available use it, otherwise
+  // fall back to the unsafe vsprintf which, in general, can be dangerous
+  // and should be avoided.
+  inline int
+  __convert_from_v(const __c_locale&, char* __out, 
+		   const int __size __attribute__((__unused__)),
+		   const char* __fmt, ...)
+  {
+    char* __old = std::setlocale(LC_NUMERIC, 0);
+    char* __sav = 0;
+    if (__old && __builtin_strcmp(__old, "C"))
+      {
+	const size_t __len = __builtin_strlen(__old) + 1;
+	__sav = new char[__len];
+	__builtin_memcpy(__sav, __old, __len);
+	std::setlocale(LC_NUMERIC, "C");
+      }
+
+    __builtin_va_list __args;
+    __builtin_va_start(__args, __fmt);
+
+#ifdef _GLIBCXX_USE_C99
+    const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
+#else
+    const int __ret = __builtin_vsprintf(__out, __fmt, __args);
+#endif
+
+    __builtin_va_end(__args);
+
+    if (__sav)
+      {
+	std::setlocale(LC_NUMERIC, __sav);
+	delete [] __sav;
+      }
+    return __ret;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cpu_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cpu_defines.h
@@ -0,0 +1,33 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cpu_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_base.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_base.h
@@ -0,0 +1,60 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the 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
+//
+
+// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1
+
+// Support for Solaris 2.5.1
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef const int* 		__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef char 		mask;
+    static const mask upper    	= _U;
+    static const mask lower 	= _L;
+    static const mask alpha 	= _U | _L;
+    static const mask digit 	= _N;
+    static const mask xdigit 	= _X | _N;
+    static const mask space 	= _S;
+    static const mask print 	= _P | _U | _L | _N | _B;
+    static const mask graph 	= _P | _U | _L | _N;
+    static const mask cntrl 	= _C;
+    static const mask punct 	= _P;
+    static const mask alnum 	= _U | _L | _N;
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_inline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_inline.h
@@ -0,0 +1,74 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_inline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    while (__low < __high)
+      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && !this->is(__m, *__low))
+      ++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && this->is(__m, *__low) != 0)
+      ++__low;
+    return __low;
+  }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_noninline.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_noninline.h
@@ -0,0 +1,98 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/ctype_noninline.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  { return _ctype_ + 1; }
+
+  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+		     size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del),
+  _M_toupper(NULL), _M_tolower(NULL),
+  _M_table(__table ? __table : classic_table())
+  {
+    memset(_M_widen, 0, sizeof(_M_widen));
+    _M_widen_ok = 0;
+    memset(_M_narrow, 0, sizeof(_M_narrow));
+    _M_narrow_ok = 0;
+  }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x);
+  }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_toupper(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  {
+    int __x = __c;
+    return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
+  }
+
+  const char*
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = this->do_tolower(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cxxabi_tweaks.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..f48f73e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cxxabi_tweaks.h
@@ -0,0 +1,59 @@
+// Control various target specific ABI tweaks.  Generic version.
+
+// Copyright (C) 2004, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/cxxabi_tweaks.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{cxxabi.h}
+ */
+
+#ifndef _CXXABI_TWEAKS_H
+#define _CXXABI_TWEAKS_H 1
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{
+  extern "C" 
+  {
+#endif
+
+  // The generic ABI uses the first byte of a 64-bit guard variable.
+#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
+#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
+  __extension__ typedef int __guard __attribute__((mode (__DI__)));
+
+  // __cxa_vec_ctor has void return type.
+  typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+  // Constructors and destructors do not return a value.
+  typedef void __cxa_cdtor_return_type;
+
+#ifdef __cplusplus
+  }
+} // namespace __cxxabiv1
+#endif
+
+#endif 
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/error_constants.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/error_constants.h
@@ -0,0 +1,178 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/error_constants.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{system_error}
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#define _GLIBCXX_ERROR_CONSTANTS 1
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  enum class errc
+    {
+      address_family_not_supported = 		EAFNOSUPPORT,
+      address_in_use = 				EADDRINUSE,
+      address_not_available = 			EADDRNOTAVAIL,
+      already_connected = 			EISCONN,
+      argument_list_too_long = 			E2BIG,
+      argument_out_of_domain = 			EDOM,
+      bad_address = 				EFAULT,
+      bad_file_descriptor = 			EBADF,
+
+#ifdef _GLIBCXX_HAVE_EBADMSG
+      bad_message = 				EBADMSG,
+#endif
+
+      broken_pipe = 				EPIPE,
+      connection_aborted = 			ECONNABORTED,
+      connection_already_in_progress = 		EALREADY,
+      connection_refused = 			ECONNREFUSED,
+      connection_reset = 			ECONNRESET,
+      cross_device_link = 			EXDEV,
+      destination_address_required = 		EDESTADDRREQ,
+      device_or_resource_busy = 		EBUSY,
+      directory_not_empty = 			ENOTEMPTY,
+      executable_format_error = 		ENOEXEC,
+      file_exists = 	       			EEXIST,
+      file_too_large = 				EFBIG,
+      filename_too_long = 			ENAMETOOLONG,
+      function_not_supported = 			ENOSYS,
+      host_unreachable = 			EHOSTUNREACH,
+
+#ifdef _GLIBCXX_HAVE_EIDRM
+      identifier_removed = 			EIDRM,
+#endif
+
+      illegal_byte_sequence = 			EILSEQ,
+      inappropriate_io_control_operation = 	ENOTTY,
+      interrupted = 				EINTR,
+      invalid_argument = 			EINVAL,
+      invalid_seek = 				ESPIPE,
+      io_error = 				EIO,
+      is_a_directory = 				EISDIR,
+      message_size = 				EMSGSIZE,
+      network_down = 				ENETDOWN,
+      network_reset = 				ENETRESET,
+      network_unreachable = 			ENETUNREACH,
+      no_buffer_space = 			ENOBUFS,
+      no_child_process = 			ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+      no_link = 				ENOLINK,
+#endif
+
+      no_lock_available = 			ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+      no_message_available = 			ENODATA, 
+#endif
+
+      no_message = 				ENOMSG, 
+      no_protocol_option = 			ENOPROTOOPT,
+      no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+      no_stream_resources = 			ENOSR,
+#endif
+
+      no_such_device_or_address = 		ENXIO,
+      no_such_device = 				ENODEV,
+      no_such_file_or_directory = 		ENOENT,
+      no_such_process = 			ESRCH,
+      not_a_directory = 			ENOTDIR,
+      not_a_socket = 				ENOTSOCK,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+      not_a_stream = 				ENOSTR,
+#endif
+
+      not_connected = 				ENOTCONN,
+      not_enough_memory = 			ENOMEM,
+
+#ifdef _GLIBCXX_HAVE_ENOTSUP
+      not_supported = 				ENOTSUP,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ECANCELED
+      operation_canceled = 			ECANCELED,
+#endif
+
+      operation_in_progress = 			EINPROGRESS,
+      operation_not_permitted = 		EPERM,
+      operation_not_supported = 		EOPNOTSUPP,
+      operation_would_block = 			EWOULDBLOCK,
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead = 				EOWNERDEAD,
+#endif
+
+      permission_denied = 			EACCES,
+
+#ifdef _GLIBCXX_HAVE_EPROTO
+      protocol_error = 				EPROTO,
+#endif
+
+      protocol_not_supported = 			EPROTONOSUPPORT,
+      read_only_file_system = 			EROFS,
+      resource_deadlock_would_occur = 		EDEADLK,
+      resource_unavailable_try_again = 		EAGAIN,
+      result_out_of_range = 			ERANGE,
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+      stream_timeout = 				ETIME,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETXTBSY
+      text_file_busy = 				ETXTBSY,
+#endif
+
+      timed_out = 				ETIMEDOUT,
+      too_many_files_open_in_system = 		ENFILE,
+      too_many_files_open = 			EMFILE,
+      too_many_links = 				EMLINK,
+      too_many_symbolic_link_levels = 		ELOOP,
+
+#ifdef _GLIBCXX_HAVE_EOVERFLOW
+      value_too_large = 			EOVERFLOW,
+#endif
+
+      wrong_protocol_type = 			EPROTOTYPE
+    };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/extc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/extc++.h
@@ -0,0 +1,71 @@
+// 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.
+ */
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/stdtr1c++.h>
+#endif
+
+#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/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-default.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-default.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-default.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-posix.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-posix.h
@@ -0,0 +1,892 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+   2008, 2009, 2010 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_POSIX_H
+#define _GLIBCXX_GCC_GTHR_POSIX_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+#define __GTHREADS_CXX0X 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#if !defined(_REENTRANT) && defined(__osf__)
+#define _REENTRANT 1
+#endif
+
+/* The following should normally be in a different header file,
+ * but I couldn't find the right location. The point of the macro
+ * definition below is to prevent libsupc++ and libstdc++ to reference
+ * weak symbols in their static C++ constructors. Such code crashes
+ * when a shared object linked statically to these libraries is
+ * loaded on Android 2.1 (Eclair) and older platform releases, due
+ * to a dynamic linker bug.
+ */
+#ifdef __ANDROID__
+#undef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+typedef pthread_cond_t __gthread_cond_t;
+typedef struct timespec __gthread_time_t;
+
+/* POSIX like conditional variables are supported.  Please look at comments
+   in gthr.h for details. */
+#define __GTHREAD_HAS_COND	1
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+#endif
+#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
+#define __GTHREAD_TIME_INIT {0,0}
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# ifndef __gthrw_pragma
+#  define __gthrw_pragma(pragma)
+# endif
+# define __gthrw2(name,name2,type) \
+  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
+  __gthrw_pragma(weak type)
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw2(name,name2,type)
+# define __gthrw_(name) name
+#endif
+
+/* Typically, __gthrw_foo is a weak reference to symbol foo.  */
+#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+   map a subset of the POSIX pthread API to mangled versions of their
+   names.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
+__gthrw3(pthread_once)
+__gthrw3(pthread_getspecific)
+__gthrw3(pthread_setspecific)
+
+__gthrw3(pthread_create)
+__gthrw3(pthread_join)
+__gthrw3(pthread_detach)
+__gthrw3(pthread_equal)
+__gthrw3(pthread_self)
+__gthrw3(pthread_cancel)
+__gthrw3(sched_yield)
+
+__gthrw3(pthread_mutex_lock)
+__gthrw3(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw3(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw3(pthread_mutex_unlock)
+__gthrw3(pthread_mutex_init)
+__gthrw3(pthread_mutex_destroy)
+
+__gthrw3(pthread_cond_broadcast)
+__gthrw3(pthread_cond_signal)
+__gthrw3(pthread_cond_wait)
+__gthrw3(pthread_cond_timedwait)
+__gthrw3(pthread_cond_destroy)
+#else
+__gthrw(pthread_once)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+
+__gthrw(pthread_create)
+__gthrw(pthread_join)
+__gthrw(pthread_equal)
+__gthrw(pthread_self)
+__gthrw(pthread_detach)
+#ifndef __BIONIC__
+__gthrw(pthread_cancel)
+#endif
+__gthrw(sched_yield)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+__gthrw(pthread_mutex_timedlock)
+#endif
+#endif /* _POSIX_TIMEOUTS */
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_cond_timedwait)
+__gthrw(pthread_cond_destroy)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+
+
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
+/* Objective-C.  */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw3(pthread_cond_init)
+__gthrw3(pthread_exit)
+#else
+__gthrw(pthread_cond_init)
+__gthrw(pthread_exit)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(sched_get_priority_max)
+__gthrw(sched_get_priority_min)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+__gthrw(pthread_attr_destroy)
+__gthrw(pthread_attr_init)
+__gthrw(pthread_attr_setdetachstate)
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+__gthrw(pthread_getschedparam)
+__gthrw(pthread_setschedparam)
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+
+/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
+   -pthreads is not specified.  The functions are dummies and most return an
+   error value.  However pthread_once returns 0 without invoking the routine
+   it is passed so we cannot pretend that the interface is active if -pthreads
+   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
+   we need to play the usual game with weak symbols.  On Solaris 10 and up, a
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
+
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+  __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
+  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
+
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+
+  /* This test is not protected to avoid taking a lock on the main code
+     path so every update of __gthread_active in a threaded program must
+     be atomic with regard to the result of the test.  */
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      if (__gthrw_(pthread_once))
+	{
+	  /* If this really is a threaded program, then we must ensure that
+	     __gthread_active has been set to 1 before exiting this block.  */
+	  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
+	  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
+	  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
+	}
+
+      /* Make sure we'll never enter this block again.  */
+      if (__gthread_active < 0)
+	__gthread_active = 0;
+
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* neither FreeBSD nor Solaris */
+
+static inline int
+__gthread_active_p (void)
+{
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(
+/* Android's C library does not provide pthread_cancel, check for
+   `pthread_create' instead.  */
+#ifndef __BIONIC__
+				       pthread_cancel
+#else
+				       pthread_create
+#endif
+				       );
+  return __gthread_active_ptr != 0;
+}
+
+#endif /* FreeBSD or Solaris */
+
+#else /* not __GXX_WEAK__ */
+
+/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
+   calls in shared flavors of the HP-UX C library.  Most of the stubs
+   have no functionality.  The details are described in the "libc cumulative
+   patch" for each subversion of HP-UX 11.  There are two special interfaces
+   provided for checking whether an application is linked to a shared pthread
+   library or not.  However, these interfaces aren't available in early
+   libpthread libraries.  We also need a test that works for archive
+   libraries.  We can't use pthread_once as some libc versions call the
+   init function.  We also can't use pthread_create or pthread_attr_init
+   as these create a thread and thereby prevent changing the default stack
+   size.  The function pthread_default_stacksize_np is available in both
+   the archive and shared versions of libpthread.   It can be used to
+   determine the default pthread stack size.  There is a stub in some
+   shared libc versions which returns a zero size if pthreads are not
+   active.  We provide an equivalent stub to handle cases where libc
+   doesn't provide one.  */
+
+#if defined(__hppa__) && defined(__hpux__)
+
+static volatile int __gthread_active = -1;
+
+static inline int
+__gthread_active_p (void)
+{
+  /* Avoid reading __gthread_active twice on the main code path.  */
+  int __gthread_active_latest_value = __gthread_active;
+  size_t __s;
+
+  if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+    {
+      pthread_default_stacksize_np (0, &__s);
+      __gthread_active = __s ? 1 : 0;
+      __gthread_active_latest_value = __gthread_active;
+    }
+
+  return __gthread_active_latest_value != 0;
+}
+
+#else /* not hppa-hpux */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+#endif /* hppa-hpux */
+
+#endif /* __GXX_WEAK__ */
+
+#ifdef _LIBOBJC
+
+/* This is the config.h file in libobjc/ */
+#include <config.h>
+
+#ifdef HAVE_SCHED_H
+# include <sched.h>
+#endif
+
+/* Key structure for maintaining thread specific storage */
+static pthread_key_t _objc_thread_storage;
+static pthread_attr_t _objc_thread_attribs;
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  if (__gthread_active_p ())
+    {
+      /* Initialize the thread storage key.  */
+      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
+	{
+	  /* The normal default detach state for threads is
+	   * PTHREAD_CREATE_JOINABLE which causes threads to not die
+	   * when you think they should.  */
+	  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
+	      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
+					      PTHREAD_CREATE_DETACHED) == 0)
+	    return 0;
+	}
+    }
+
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
+      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
+    return 0;
+
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (*func)(void *), void *arg)
+{
+  objc_thread_t thread_id;
+  pthread_t new_thread_handle;
+
+  if (!__gthread_active_p ())
+    return NULL;
+
+  if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+				  (void *) func, arg)))
+    thread_id = (objc_thread_t) new_thread_handle;
+  else
+    thread_id = NULL;
+
+  return thread_id;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority)
+{
+  if (!__gthread_active_p ())
+    return -1;
+  else
+    {
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+      pthread_t thread_id = __gthrw_(pthread_self) ();
+      int policy;
+      struct sched_param params;
+      int priority_min, priority_max;
+
+      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
+	{
+	  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
+	    return -1;
+
+	  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
+	    return -1;
+
+	  if (priority > priority_max)
+	    priority = priority_max;
+	  else if (priority < priority_min)
+	    priority = priority_min;
+	  params.sched_priority = priority;
+
+	  /*
+	   * The solaris 7 and several other man pages incorrectly state that
+	   * this should be a pointer to policy but pthread.h is universally
+	   * at odds with this.
+	   */
+	  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
+	    return 0;
+	}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+      return -1;
+    }
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+  if (__gthread_active_p ())
+    {
+      int policy;
+      struct sched_param params;
+
+      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
+	return params.sched_priority;
+      else
+	return -1;
+    }
+  else
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+    return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  if (__gthread_active_p ())
+    __gthrw_(sched_yield) ();
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  if (__gthread_active_p ())
+    /* exit the thread */
+    __gthrw_(pthread_exit) (&__objc_thread_exit_status);
+
+  /* Failed if we reached here */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  if (__gthread_active_p ())
+    return (objc_thread_t) __gthrw_(pthread_self) ();
+  else
+    return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
+  else
+    {
+      thread_local_storage = value;
+      return 0;
+    }
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_getspecific) (_objc_thread_storage);
+  else
+    return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
+
+      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
+	{
+	  objc_free (mutex->backend);
+	  mutex->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    {
+      int count;
+
+      /*
+       * Posix Threads specifically require that the thread be unlocked
+       * for __gthrw_(pthread_mutex_destroy) to work.
+       */
+
+      do
+	{
+	  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
+	  if (count < 0)
+	    return -1;
+	}
+      while (count);
+
+      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
+	return -1;
+
+      objc_free (mutex->backend);
+      mutex->backend = NULL;
+    }
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex)
+{
+  if (__gthread_active_p ()
+      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
+    {
+      return -1;
+    }
+
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      condition->backend = objc_malloc (sizeof (pthread_cond_t));
+
+      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
+	{
+	  objc_free (condition->backend);
+	  condition->backend = NULL;
+	  return -1;
+	}
+    }
+
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    {
+      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
+	return -1;
+
+      objc_free (condition->backend);
+      condition->backend = NULL;
+    }
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
+			      (pthread_mutex_t *) mutex->backend);
+  else
+    return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
+  else
+    return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
+		  void *__args)
+{
+  return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
+}
+
+static inline int
+__gthread_join (__gthread_t __threadid, void **__value_ptr)
+{
+  return __gthrw_(pthread_join) (__threadid, __value_ptr);
+}
+
+static inline int
+__gthread_detach (__gthread_t __threadid)
+{
+  return __gthrw_(pthread_detach) (__threadid);
+}
+
+static inline int
+__gthread_equal (__gthread_t __t1, __gthread_t __t2)
+{
+  return __gthrw_(pthread_equal) (__t1, __t2);
+}
+
+static inline __gthread_t
+__gthread_self (void)
+{
+  return __gthrw_(pthread_self) ();
+}
+
+static inline int
+__gthread_yield (void)
+{
+  return __gthrw_(sched_yield) ();
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  return __gthrw_(pthread_key_create) (__key, __dtor);
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_key_delete) (__key);
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  return __gthrw_(pthread_getspecific) (__key);
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  return __gthrw_(pthread_setspecific) (__key, __ptr);
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
+			   const __gthread_time_t *__abs_timeout)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
+  else
+    return 0;
+}
+#endif
+#endif
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__gthread_active_p ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+#endif
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS >= 0
+static inline int
+__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
+				     const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_mutex_timedlock (__mutex, __abs_timeout);
+}
+#endif
+#endif
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+static inline int
+__gthread_cond_broadcast (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_broadcast) (__cond);
+}
+
+static inline int
+__gthread_cond_signal (__gthread_cond_t *__cond)
+{
+  return __gthrw_(pthread_cond_signal) (__cond);
+}
+
+static inline int
+__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
+{
+  return __gthrw_(pthread_cond_wait) (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
+			  const __gthread_time_t *__abs_timeout)
+{
+  return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
+			       __gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_cond_wait (__cond, __mutex);
+}
+
+static inline int
+__gthread_cond_timedwait_recursive (__gthread_cond_t *__cond,
+				    __gthread_recursive_mutex_t *__mutex,
+				    const __gthread_time_t *__abs_timeout)
+{
+  return __gthread_cond_timedwait (__cond, __mutex, __abs_timeout);
+}
+
+static inline int
+__gthread_cond_destroy (__gthread_cond_t* __cond)
+{
+  return __gthrw_(pthread_cond_destroy) (__cond);
+}
+
+#endif /* _LIBOBJC */
+
+#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-single.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-single.h
@@ -0,0 +1,292 @@
+/* Threads compatibility routines for libgcc2 and libobjc.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_SINGLE_H
+#define _GLIBCXX_GCC_GTHR_SINGLE_H
+
+/* Just provide compatibility for mutex handling.  */
+
+typedef int __gthread_key_t;
+typedef int __gthread_once_t;
+typedef int __gthread_mutex_t;
+typedef int __gthread_recursive_mutex_t;
+
+#define __GTHREAD_ONCE_INIT 0
+#define __GTHREAD_MUTEX_INIT 0
+#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
+
+#define _GLIBCXX_UNUSED __attribute__((unused))
+
+#ifdef _LIBOBJC
+
+/* Thread local storage for a single thread */
+static void *thread_local_storage = NULL;
+
+/* Backend initialization functions */
+
+/* Initialize the threads subsystem.  */
+static inline int
+__gthread_objc_init_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Close the threads subsystem.  */
+static inline int
+__gthread_objc_close_thread_system (void)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Backend thread functions */
+
+/* Create a new thread of execution.  */
+static inline objc_thread_t
+__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return NULL;
+}
+
+/* Set the current thread's priority.  */
+static inline int
+__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
+{
+  /* No thread support available */
+  return -1;
+}
+
+/* Return the current thread's priority.  */
+static inline int
+__gthread_objc_thread_get_priority (void)
+{
+  return OBJC_THREAD_INTERACTIVE_PRIORITY;
+}
+
+/* Yield our process time to another thread.  */
+static inline void
+__gthread_objc_thread_yield (void)
+{
+  return;
+}
+
+/* Terminate the current thread.  */
+static inline int
+__gthread_objc_thread_exit (void)
+{
+  /* No thread support available */
+  /* Should we really exit the program */
+  /* exit (&__objc_thread_exit_status); */
+  return -1;
+}
+
+/* Returns an integer value which uniquely describes a thread.  */
+static inline objc_thread_t
+__gthread_objc_thread_id (void)
+{
+  /* No thread support, use 1.  */
+  return (objc_thread_t) 1;
+}
+
+/* Sets the thread's local storage pointer.  */
+static inline int
+__gthread_objc_thread_set_data (void *value)
+{
+  thread_local_storage = value;
+  return 0;
+}
+
+/* Returns the thread's local storage pointer.  */
+static inline void *
+__gthread_objc_thread_get_data (void)
+{
+  return thread_local_storage;
+}
+
+/* Backend mutex functions */
+
+/* Allocate a mutex.  */
+static inline int
+__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a mutex.  */
+static inline int
+__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Try to grab a lock on a mutex.  */
+static inline int
+__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  /* There can only be one thread, so we always get the lock */
+  return 0;
+}
+
+/* Unlock the mutex */
+static inline int
+__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Backend condition mutex functions */
+
+/* Allocate a condition.  */
+static inline int
+__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Deallocate a condition.  */
+static inline int
+__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wait on the condition */
+static inline int
+__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
+			       objc_mutex_t mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up all threads waiting on this condition.  */
+static inline int
+__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+/* Wake up one thread waiting on this condition.  */
+static inline int
+__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+#else /* _LIBOBJC */
+
+static inline int
+__gthread_active_p (void)
+{
+  return 0;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int _GLIBCXX_UNUSED
+__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static int _GLIBCXX_UNUSED
+__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
+{
+  return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_lock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_trylock (__mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  return __gthread_mutex_unlock (__mutex);
+}
+
+#endif /* _LIBOBJC */
+
+#undef _GLIBCXX_UNUSED
+
+#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-tpf.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-tpf.h
@@ -0,0 +1,229 @@
+/* Threads compatibility routines for libgcc2 and libobjc.
+   Compile this one with gcc.
+   Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* TPF needs its own version of gthr-*.h because TPF always links to
+   the thread library.  However, for performance reasons we still do not
+   want to issue thread api calls unless a check is made to see that we
+   are running as a thread.  */
+
+#ifndef _GLIBCXX_GCC_GTHR_TPF_H
+#define _GLIBCXX_GCC_GTHR_TPF_H
+
+/* POSIX threads specific definitions.
+   Easy, since the interface is just one-to-one mapping.  */
+
+#define __GTHREADS 1
+
+/* Some implementations of <pthread.h> require this to be defined.  */
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
+
+#include <pthread.h>
+#include <unistd.h>
+
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+typedef pthread_mutex_t __gthread_recursive_mutex_t;
+
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#endif
+
+#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
+#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
+
+#define NOTATHREAD   00
+#define ECBBASEPTR (unsigned long int) *(unsigned int *)0x00000514u
+#define ECBPG2PTR  ECBBASEPTR + 0x1000
+#define CE2THRCPTR *((unsigned char *)(ECBPG2PTR + 16))
+#define __tpf_pthread_active() (CE2THRCPTR != NOTATHREAD)
+
+#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
+# define __gthrw(name) \
+  static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw_(name) __gthrw_ ## name
+#else
+# define __gthrw(name)
+# define __gthrw_(name) name
+#endif
+
+__gthrw(pthread_once)
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+__gthrw(pthread_create)
+
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutexattr_init)
+__gthrw(pthread_mutexattr_settype)
+__gthrw(pthread_mutexattr_destroy)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_destroy)
+
+static inline int
+__gthread_active_p (void)
+{
+  return 1;
+}
+
+static inline int
+__gthread_once (__gthread_once_t *__once, void (*__func) (void))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_once) (__once, __func);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_create) (__key, __dtor);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_key_delete (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_key_delete) (__key);
+  else
+    return -1;
+}
+
+static inline void *
+__gthread_getspecific (__gthread_key_t __key)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_getspecific) (__key);
+  else
+    return NULL;
+}
+
+static inline int
+__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_setspecific) (__key, __ptr);
+  else
+    return -1;
+}
+
+static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_destroy) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_lock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_lock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_trylock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthrw_(pthread_mutex_unlock) (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_lock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_trylock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    return __gthread_mutex_unlock (__mutex);
+  else
+    return 0;
+}
+
+static inline int
+__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
+{
+  if (__tpf_pthread_active ())
+    {
+      pthread_mutexattr_t __attr;
+      int __r;
+
+      __r = __gthrw_(pthread_mutexattr_init) (&__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
+						   PTHREAD_MUTEX_RECURSIVE);
+      if (!__r)
+	__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
+      if (!__r)
+	__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
+      return __r;
+    }
+  return 0;
+}
+
+
+#endif /* ! _GLIBCXX_GCC_GTHR_TPF_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr.h
@@ -0,0 +1,173 @@
+/* Threads compatibility routines for libgcc2.  */
+/* Compile this one with gcc.  */
+/* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the 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 _GLIBCXX_GCC_GTHR_H
+#define _GLIBCXX_GCC_GTHR_H
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility push(default)
+#endif
+
+/* If this file is compiled with threads support, it must
+       #define __GTHREADS 1
+   to indicate that threads support is present.  Also it has define
+   function
+     int __gthread_active_p ()
+   that returns 1 if thread system is active, 0 if not.
+
+   The threads interface must define the following types:
+     __gthread_key_t
+     __gthread_once_t
+     __gthread_mutex_t
+     __gthread_recursive_mutex_t
+
+   The threads interface must define the following macros:
+
+     __GTHREAD_ONCE_INIT
+     		to initialize __gthread_once_t
+     __GTHREAD_MUTEX_INIT
+     		to initialize __gthread_mutex_t to get a fast
+		non-recursive mutex.
+     __GTHREAD_MUTEX_INIT_FUNCTION
+     		some systems can't initialize a mutex without a
+		function call.  On such systems, define this to a
+		function which looks like this:
+		  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
+		Don't define __GTHREAD_MUTEX_INIT in this case
+     __GTHREAD_RECURSIVE_MUTEX_INIT
+     __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
+     		as above, but for a recursive mutex.
+
+   The threads interface must define the following static functions:
+
+     int __gthread_once (__gthread_once_t *once, void (*func) ())
+
+     int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
+     int __gthread_key_delete (__gthread_key_t key)
+
+     void *__gthread_getspecific (__gthread_key_t key)
+     int __gthread_setspecific (__gthread_key_t key, const void *ptr)
+
+     int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
+
+     int __gthread_mutex_lock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
+     int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
+
+     int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
+     int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
+
+   The following are supported in POSIX threads only. They are required to
+   fix a deadlock in static initialization inside libsupc++. The header file
+   gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
+   features are supported.
+
+   Types:
+     __gthread_cond_t
+
+   Macros:
+     __GTHREAD_COND_INIT
+     __GTHREAD_COND_INIT_FUNCTION
+
+   Interface:
+     int __gthread_cond_broadcast (__gthread_cond_t *cond);
+     int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
+     int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
+					__gthread_recursive_mutex_t *mutex);
+
+   All functions returning int should return zero on success or the error
+   number.  If the operation is not supported, -1 is returned.
+
+   If the following are also defined, you should
+     #define __GTHREADS_CXX0X 1
+   to enable the c++0x thread library.
+
+   Types:
+     __gthread_t
+     __gthread_time_t
+
+   Interface:
+     int __gthread_create (__gthread_t *thread, void *(*func) (void*),
+                           void *args);
+     int __gthread_join (__gthread_t thread, void **value_ptr);
+     int __gthread_detach (__gthread_t thread);
+     int __gthread_equal (__gthread_t t1, __gthread_t t2);
+     __gthread_t __gthread_self (void);
+     int __gthread_yield (void);
+
+     int __gthread_mutex_timedlock (__gthread_mutex_t *m,
+                                    const __gthread_time_t *abs_timeout);
+     int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
+                                          const __gthread_time_t *abs_time);
+
+     int __gthread_cond_signal (__gthread_cond_t *cond);
+     int __gthread_cond_timedwait (__gthread_cond_t *cond,
+                                   __gthread_mutex_t *mutex,
+                                   const __gthread_time_t *abs_timeout);
+     int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond,
+                                             __gthread_recursive_mutex_t *mutex,
+                                             const __gthread_time_t *abs_time)
+
+   Currently supported threads packages are
+     TPF threads with -D__tpf__
+     POSIX/Unix98 threads with -D_PTHREADS
+     POSIX/Unix95 threads with -D_PTHREADS95
+     DCE threads with -D_DCE_THREADS
+     Solaris/UI threads with -D_SOLARIS_THREADS
+
+*/
+
+/* Check first for thread specific defines.  */
+#if defined (_GLIBCXX___tpf_GLIBCXX___)
+#include <bits/gthr-tpf.h>
+#elif _GLIBCXX__PTHREADS
+#include <bits/gthr-posix.h>
+#elif _GLIBCXX__PTHREADS95
+#include <bits/gthr-posix95.h>
+#elif _GLIBCXX__DCE_THREADS
+#include <bits/gthr-dce.h>
+#elif _GLIBCXX__SOLARIS_THREADS
+#include <bits/gthr-solaris.h>
+
+/* Include GTHREAD_FILE if one is defined.  */
+#elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
+#if __GXX_WEAK__
+#ifndef _GLIBCXX_GTHREAD_USE_WEAK
+#define _GLIBCXX_GTHREAD_USE_WEAK 1
+#endif
+#endif
+#include <bits/gthr-default.h>
+
+/* Fallback to single thread definitions.  */
+#else
+#include <bits/gthr-single.h>
+#endif
+
+#ifndef _GLIBCXX_HIDE_EXPORTS
+#pragma GCC visibility pop
+#endif
+
+#endif /* ! _GLIBCXX_GCC_GTHR_H */
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/messages_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/messages_members.h
@@ -0,0 +1,93 @@
+// std::messages implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/messages_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // Non-virtual member functions.
+  template<typename _CharT>
+     messages<_CharT>::messages(size_t __refs)
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+     messages<_CharT>::messages(__c_locale, const char*, size_t __refs) 
+     : facet(__refs)
+     { _M_c_locale_messages = _S_get_c_locale(); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
+			   const char*) const
+    { return this->do_open(__s, __loc); }
+
+  // Virtual member functions.
+  template<typename _CharT>
+    messages<_CharT>::~messages()
+    { _S_destroy_c_locale(_M_c_locale_messages); }
+
+  template<typename _CharT>
+    typename messages<_CharT>::catalog 
+    messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
+    { return 0; }
+
+  template<typename _CharT>
+    typename messages<_CharT>::string_type  
+    messages<_CharT>::do_get(catalog, int, int, 
+			     const string_type& __dfault) const
+    { return __dfault; }
+
+  template<typename _CharT>
+    void    
+    messages<_CharT>::do_close(catalog) const 
+    { }
+
+   // messages_byname
+   template<typename _CharT>
+     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
+     : messages<_CharT>(__refs) 
+     { 
+	if (__builtin_strcmp(__s, "C") != 0
+	    && __builtin_strcmp(__s, "POSIX") != 0)
+	  {
+	    this->_S_destroy_c_locale(this->_M_c_locale_messages);
+	    this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
+	  }
+     }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/os_defines.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/os_defines.h
@@ -0,0 +1,36 @@
+// Specific definitions for Bionic  -*- C++ -*-
+
+// Copyright (C) 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/os_defines.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES 1
+
+// System-specific #define, typedefs, corrections, etc, go here.  This
+// file will come before all others.
+
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdc++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdc++.h
@@ -0,0 +1,116 @@
+// C++ includes used for precompiling -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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
+#ifndef _GLIBCXX_NO_ASSERT
+#include <cassert>
+#endif
+#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 <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 <atomic>
+#include <chrono>
+#include <condition_variable>
+#include <forward_list>
+#include <future>
+#include <initializer_list>
+#include <mutex>
+#include <random>
+#include <ratio>
+#include <regex>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <typeindex>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#endif
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdtr1c++.h
similarity index 100%
rename from 8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h
rename to 8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdtr1c++.h
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/time_members.h b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/time_members.h
@@ -0,0 +1,94 @@
+// std::time_get, std::time_put implementation, generic version -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC 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/time_members.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(size_t __refs) 
+    : facet(__refs), _M_data(0)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
+    : facet(__refs), _M_data(__cache)
+    { 
+      _M_name_timepunct = _S_get_c_name();
+      _M_initialize_timepunct(); 
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, 
+				     size_t __refs) 
+    : facet(__refs), _M_data(0)
+    {
+      if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
+	{
+	  const size_t __len = __builtin_strlen(__s) + 1;
+	  char* __tmp = new char[__len];
+	  __builtin_memcpy(__tmp, __s, __len);
+	  _M_name_timepunct = __tmp;
+	}
+      else
+	_M_name_timepunct = _S_get_c_name();
+
+      __try
+	{ _M_initialize_timepunct(__cloc); }
+      __catch(...)
+	{
+	  if (_M_name_timepunct != _S_get_c_name())
+	    delete [] _M_name_timepunct;
+	  __throw_exception_again;
+	}
+    }
+
+  template<typename _CharT>
+    __timepunct<_CharT>::~__timepunct()
+    { 
+      if (_M_name_timepunct != _S_get_c_name())
+	delete [] _M_name_timepunct;
+      delete _M_data;
+      _S_destroy_c_locale(_M_c_locale_timepunct); 
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_shared.so b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_shared.so
new file mode 100755
index 0000000..8b7f0ef
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_shared.so
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_static.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_static.a
new file mode 100644
index 0000000..ebe9532
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_static.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libsupc++.a b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libsupc++.a
new file mode 100644
index 0000000..6e100f7
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libsupc++.a
Binary files differ
diff --git a/8/sources/cxx-stl/gnu-libstdc++/include b/8/sources/cxx-stl/gnu-libstdc++/include
new file mode 120000
index 0000000..0e7f94e
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/include
@@ -0,0 +1 @@
+4.6/include
\ No newline at end of file
diff --git a/8/sources/cxx-stl/gnu-libstdc++/libs b/8/sources/cxx-stl/gnu-libstdc++/libs
new file mode 120000
index 0000000..050a8bb
--- /dev/null
+++ b/8/sources/cxx-stl/gnu-libstdc++/libs
@@ -0,0 +1 @@
+4.6/libs
\ No newline at end of file
