diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/algorithm b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/algorithm
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/algorithm
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/algorithm
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/array b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/array
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/array
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/array
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/auto_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/auto_ptr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/auto_ptr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/auto_ptr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/backward_warning.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/backward_warning.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/backward_warning.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/backward_warning.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/binders.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/binders.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/binders.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/binders.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_fun.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_fun.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_fun.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_fun.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hash_set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hash_set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hashtable.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hashtable.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/hashtable.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/hashtable.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/strstream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/strstream
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/backward/strstream
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/backward/strstream
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/algorithmfwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/algorithmfwd.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/algorithmfwd.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/algorithmfwd.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_0.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_0.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_0.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_0.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_2.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_2.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomic_2.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomic_2.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_c.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_c.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_c.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_c.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_cxx.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_cxx.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/atomicfwd_cxx.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/atomicfwd_cxx.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_ios.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_ios.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/basic_string.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/basic_string.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/boost_concept_check.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/boost_concept_check.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/boost_concept_check.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/boost_concept_check.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/char_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/char_traits.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/char_traits.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/char_traits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/cmath.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cmath.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/cmath.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cmath.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/codecvt.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/codecvt.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/codecvt.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/codecvt.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/concept_check.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/concept_check.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/concept_check.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/concept_check.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/cpp_type_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cpp_type_traits.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/cpp_type_traits.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/cpp_type_traits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/deque.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/deque.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/deque.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/deque.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/forward_list.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/forward_list.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/fstream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/fstream.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/fstream.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/fstream.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/functexcept.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functexcept.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/functexcept.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functexcept.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/functional_hash.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functional_hash.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/functional_hash.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/functional_hash.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice_array.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/gslice_array.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/gslice_array.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/hashtable.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/hashtable.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/hashtable.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/hashtable.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/indirect_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/indirect_array.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/indirect_array.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/indirect_array.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/ios_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ios_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/ios_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ios_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/istream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/istream.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/istream.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/istream.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/list.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/list.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/list.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/list.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_classes.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_classes.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/locale_facets_nonio.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/locale_facets_nonio.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/localefwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/localefwd.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/localefwd.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/localefwd.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/mask_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/mask_array.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/mask_array.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/mask_array.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/move.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/move.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/move.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/move.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream_insert.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream_insert.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/ostream_insert.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/ostream_insert.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/postypes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/postypes.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/postypes.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/postypes.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/shared_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/shared_ptr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/shared_ptr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/shared_ptr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/slice_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/slice_array.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/slice_array.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/slice_array.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/sstream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/sstream.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/sstream.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/sstream.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algo.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algo.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algo.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algo.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algobase.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_algobase.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algobase.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_bvector.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_bvector.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_bvector.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_bvector.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_construct.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_construct.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_construct.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_construct.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_deque.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_deque.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_deque.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_deque.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_function.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_function.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_function.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_function.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_heap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_heap.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_heap.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_heap.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_funcs.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_funcs.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_funcs.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_funcs.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_types.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_types.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_iterator_base_types.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_iterator_base_types.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_list.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_list.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_list.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_list.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_map.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_map.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_map.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multimap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multimap.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multimap.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multimap.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multiset.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multiset.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_multiset.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_multiset.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_numeric.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_numeric.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_numeric.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_numeric.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_pair.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_pair.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_pair.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_pair.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_queue.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_queue.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_queue.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_queue.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_raw_storage_iter.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_raw_storage_iter.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_raw_storage_iter.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_raw_storage_iter.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_relops.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_relops.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_relops.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_relops.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_set.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_set.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_set.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_stack.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_stack.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_stack.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_stack.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tempbuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tempbuf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tempbuf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tempbuf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tree.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_tree.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tree.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_uninitialized.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_uninitialized.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_uninitialized.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_uninitialized.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_vector.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_vector.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stl_vector.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_vector.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stream_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stream_iterator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stream_iterator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stream_iterator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf_iterator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/streambuf_iterator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/streambuf_iterator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stringfwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stringfwd.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/stringfwd.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stringfwd.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/unique_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/unique_ptr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/unique_ptr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/unique_ptr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_after.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_after.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_after.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_after.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_array.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_array.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_before.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_before.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/valarray_before.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/valarray_before.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/vector.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/vector.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bits/vector.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/vector.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bitset b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bitset
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/bitset
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bitset
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/c++0x_warning.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/c++0x_warning.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/c++0x_warning.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/c++0x_warning.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cassert b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cassert
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cassert
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cassert
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ccomplex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ccomplex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ccomplex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ccomplex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cctype
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cctype
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cctype
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cerrno b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cerrno
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cerrno
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cerrno
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cfenv b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfenv
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cfenv
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfenv
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cfloat b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfloat
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cfloat
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cfloat
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/chrono b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/chrono
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/chrono
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/chrono
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cinttypes b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cinttypes
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cinttypes
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cinttypes
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ciso646 b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ciso646
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ciso646
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ciso646
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/climits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/climits
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/climits
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/climits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/clocale b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/clocale
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/clocale
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/clocale
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cmath
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cmath
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cmath
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/complex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/complex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/complex.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/complex.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/complex.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/condition_variable b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/condition_variable
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/condition_variable
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/condition_variable
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/csetjmp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csetjmp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/csetjmp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csetjmp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/csignal b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csignal
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/csignal
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/csignal
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdarg b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdarg
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdarg
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdarg
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdatomic b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdatomic
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdatomic
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdatomic
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdbool b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdbool
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdbool
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdbool
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstddef b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstddef
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstddef
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstddef
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdint b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdint
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdint
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdint
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdio
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdio
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdio
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdlib b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdlib
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstdlib
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstdlib
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstring b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstring
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cstring
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cstring
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ctgmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctgmath
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ctgmath
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctgmath
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ctime b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctime
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ctime
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ctime
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cwchar b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwchar
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cwchar
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwchar
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cwctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwctype
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cwctype
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cwctype
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cxxabi-forced.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi-forced.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cxxabi-forced.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi-forced.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cxxabi.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/cxxabi.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/cxxabi.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/bitset b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/bitset
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/bitset
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/bitset
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/debug.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/debug.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/debug.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/debug.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/deque b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/deque
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/deque
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/deque
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/formatter.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/formatter.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/formatter.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/formatter.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/functions.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/functions.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/functions.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/functions.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/list
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/list
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/list
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/macros.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/macros.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/macros.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/macros.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/map.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/map.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/multimap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multimap.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/multimap.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multimap.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/multiset.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multiset.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/multiset.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/multiset.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_iterator.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_iterator.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_sequence.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_sequence.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/safe_sequence.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/safe_sequence.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/set.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/set.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/string b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/string
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/string
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/string
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/unordered_set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/unordered_set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/vector b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/vector
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/vector
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/debug/vector
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/deque b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/deque
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/deque
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/deque
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/exception b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/exception
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/exception_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/exception_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/exception_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_ptr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/exception_ptr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/exception_ptr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/algorithm b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/algorithm
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/algorithm
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/algorithm
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/array_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/array_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/array_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/array_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/atomicity.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/atomicity.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/atomicity.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/atomicity.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/bitmap_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/bitmap_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/bitmap_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/bitmap_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/cast.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/cast.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/cast.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/cast.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/codecvt_specializations.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/codecvt_specializations.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/codecvt_specializations.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/codecvt_specializations.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/concurrence.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/concurrence.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/concurrence.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/concurrence.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/debug_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/debug_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/debug_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/debug_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/enc_filebuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/enc_filebuf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/enc_filebuf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/enc_filebuf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/extptr_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/extptr_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/extptr_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/extptr_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/functional
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/functional
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/functional
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/hash_set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/hash_set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/iterator b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/iterator
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/iterator
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/iterator
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/malloc_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/malloc_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/malloc_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/malloc_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/memory b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/memory
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/memory
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/memory
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/mt_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/mt_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/mt_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/mt_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/new_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/new_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/new_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/new_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric_traits.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/numeric_traits.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/numeric_traits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/assoc_container.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/assoc_container.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/assoc_container.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/assoc_container.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_types.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/basic_types.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cond_dealtor.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/cond_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/container_base_dispatch.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/container_base_dispatch.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/debug_map_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/debug_map_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/debug_map_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/debug_map_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/head.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/head.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp b/android-ndk-r8/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%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp b/android-ndk-r8/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%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/node.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/standard_policies.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/standard_policies.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_trace_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/tree_trace_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/android-ndk-r8/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%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
copy to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/type_utils.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/type_utils.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/type_utils.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/type_utils.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/types_traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/types_traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/exception.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/exception.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/exception.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/exception.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/hash_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/hash_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/hash_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/hash_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/list_update_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/list_update_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/list_update_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/list_update_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/priority_queue.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/priority_queue.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/priority_queue.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/priority_queue.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tag_and_trait.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tag_and_trait.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tag_and_trait.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tag_and_trait.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tree_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tree_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/tree_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/tree_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/trie_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/trie_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/trie_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pb_ds/trie_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pod_char_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pod_char_traits.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pod_char_traits.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pod_char_traits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pointer.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pointer.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pointer.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pointer.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pool_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pool_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pool_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/pool_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/rb_tree b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rb_tree
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/rb_tree
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rb_tree
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/rc_string_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rc_string_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/rc_string_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rc_string_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/rope b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rope
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/rope
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/rope
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/ropeimpl.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/ropeimpl.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/ropeimpl.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/ropeimpl.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/slist b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/slist
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/slist
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/slist
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/sso_string_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/sso_string_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/sso_string_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/sso_string_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_filebuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_filebuf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_filebuf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_filebuf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_sync_filebuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_sync_filebuf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/stdio_sync_filebuf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/stdio_sync_filebuf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/string_conversions.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/string_conversions.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/string_conversions.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/string_conversions.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/throw_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/throw_allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/throw_allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/throw_allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/type_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/type_traits.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/type_traits.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/type_traits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/typelist.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/typelist.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/typelist.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/typelist.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_fwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_fwd.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_fwd.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_fwd.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_util.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_util.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/vstring_util.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ext/vstring_util.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/fenv.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fenv.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/fenv.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fenv.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/forward_list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/forward_list
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/forward_list
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/forward_list
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/fstream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fstream
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/fstream
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/fstream
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/functional
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/functional
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/functional
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/initializer_list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/initializer_list
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/initializer_list
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/initializer_list
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iomanip b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iomanip
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iomanip
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iomanip
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ios b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ios
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ios
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ios
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iosfwd b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iosfwd
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iosfwd
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iosfwd
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iostream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iostream
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iostream
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iostream
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/istream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/istream
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/istream
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/istream
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iterator b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iterator
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/iterator
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/iterator
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/limits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/limits
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/limits
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/limits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/list
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/list
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/list
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/locale b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/locale
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/locale
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/locale
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/memory b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/memory
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/memory
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/memory
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/mutex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/mutex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/mutex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/mutex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/new b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/new
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/new
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/new
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/numeric b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/numeric
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/numeric
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/numeric
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ostream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ostream
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ostream
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ostream
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/queue b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/queue
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/queue
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/queue
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/random b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/random
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/random
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/random
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ratio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ratio
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ratio
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/ratio
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/regex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/regex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/regex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/regex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/sstream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/sstream
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/sstream
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/sstream
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stack b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stack
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stack
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stack
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stdatomic.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdatomic.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stdatomic.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdatomic.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stdexcept b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdexcept
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stdexcept
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/stdexcept
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/streambuf b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/streambuf
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/streambuf
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/streambuf
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/string b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/string
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/string
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/string
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/system_error b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/system_error
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/system_error
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/system_error
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tgmath.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tgmath.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/thread b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/thread
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/thread
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/thread
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/array b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/array
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/array
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/array
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/bessel_function.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/bessel_function.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/bessel_function.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/bessel_function.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/beta_function.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/beta_function.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/beta_function.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/beta_function.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ccomplex
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ccomplex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cctype
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cctype
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cctype
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfenv b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfenv
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfenv
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfenv
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfloat
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cfloat
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cinttypes b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cinttypes
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cinttypes
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cinttypes
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/climits
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/climits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cmath
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cmath
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cmath
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/complex.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdarg
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdarg
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdbool
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdbool
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdint b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdint
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdint
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdint
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdio
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdio
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdio
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdlib b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdlib
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdlib
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cstdlib
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctgmath
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctgmath
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctime
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctime
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctype.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ctype.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwchar b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwchar
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwchar
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwchar
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwctype
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cwctype
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/cwctype
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ell_integral.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ell_integral.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ell_integral.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/ell_integral.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/exp_integral.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/exp_integral.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/exp_integral.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/exp_integral.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/fenv.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/fenv.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/float.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/float.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional_hash.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional_hash.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/functional_hash.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/functional_hash.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/gamma.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/gamma.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/gamma.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/gamma.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/hashtable.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hashtable.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/hashtable.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hashtable.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/hypergeometric.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hypergeometric.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/hypergeometric.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/hypergeometric.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/inttypes.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/inttypes.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/legendre_function.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/legendre_function.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/legendre_function.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/legendre_function.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/limits.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/limits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/math.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/math.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/memory b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/memory
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/memory
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/memory
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/modified_bessel_func.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/modified_bessel_func.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/modified_bessel_func.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/modified_bessel_func.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_hermite.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_hermite.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_hermite.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_hermite.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_laguerre.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_laguerre.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/poly_laguerre.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/poly_laguerre.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/random b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/random
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/random
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/random
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/regex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/regex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/regex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/regex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/riemann_zeta.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/riemann_zeta.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/riemann_zeta.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/riemann_zeta.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/shared_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/shared_ptr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/shared_ptr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/shared_ptr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/special_function_util.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/special_function_util.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/special_function_util.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/special_function_util.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdarg.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdarg.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdbool.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdbool.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdint.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdint.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdio.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdio.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdlib.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/stdlib.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tgmath.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tgmath.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/tuple b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tuple
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/tuple
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/tuple
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/type_traits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/type_traits
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/type_traits
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/type_traits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/unordered_set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/unordered_set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/utility b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/utility
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/utility
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/utility
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wchar.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wchar.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wctype.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1/wctype.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/array b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/array
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/array
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/array
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/boost_sp_counted_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/boost_sp_counted_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/boost_sp_counted_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/boost_sp_counted_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cctype
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cctype
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cctype
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cfenv b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cfenv
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cfenv
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cfenv
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cinttypes b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cinttypes
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cinttypes
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cinttypes
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cmath
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cmath
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cmath
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/complex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/complex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/complex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/complex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdint b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdint
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdint
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdint
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdio
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdio
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdio
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdlib b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdlib
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cstdlib
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cstdlib
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwchar b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwchar
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwchar
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwchar
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwctype
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/cwctype
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/cwctype
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional_hash.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional_hash.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/functional_hash.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/functional_hash.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable_policy.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable_policy.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/hashtable_policy.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/hashtable_policy.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random.tcc
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/random.tcc
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/random.tcc
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/regex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/regex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/regex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/regex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/type_traits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/type_traits
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/type_traits
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/type_traits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/unordered_set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/unordered_set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/utility b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/utility
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1_impl/utility
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tr1_impl/utility
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tuple b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tuple
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tuple
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/tuple
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/type_traits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/type_traits
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/type_traits
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/type_traits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/typeinfo b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/typeinfo
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/typeinfo
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/typeinfo
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_map
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/unordered_map
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_set
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/unordered_set
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/unordered_set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/utility b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/utility
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/utility
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/utility
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/valarray b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/valarray
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/valarray
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/valarray
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/vector b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/vector
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/vector
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/include/vector
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/atomic_word.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/basic_file.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/basic_file.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/basic_file.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++config.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++config.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++config.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++io.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++io.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++io.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++locale.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/c++locale.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/c++locale.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cpu_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cpu_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cpu_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_inline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_inline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_inline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_noninline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/ctype_noninline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/ctype_noninline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/error_constants.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/error_constants.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/error_constants.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/extc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/extc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/extc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-default.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-default.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-default.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-posix.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-posix.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-posix.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-single.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-single.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-single.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-tpf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr-tpf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr-tpf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/gthr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/gthr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/messages_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/messages_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/messages_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/os_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/os_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/os_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdtr1c++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/time_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/time_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/include/bits/time_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_shared.so
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_static.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_static.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libsupc++.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libsupc++.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi-v7a/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/atomic_word.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/basic_file.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/basic_file.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/basic_file.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++config.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++config.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++config.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++io.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++io.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++io.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++locale.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/c++locale.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/c++locale.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cpu_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cpu_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cpu_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_inline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_inline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_inline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_noninline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/ctype_noninline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/ctype_noninline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/cxxabi_tweaks.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/cxxabi_tweaks.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/error_constants.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/error_constants.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/error_constants.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/extc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/extc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/extc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-default.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-default.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-default.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-posix.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-posix.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-posix.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-single.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-single.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-single.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-tpf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr-tpf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr-tpf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/gthr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/gthr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/messages_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/messages_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/messages_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/os_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/os_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/os_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdtr1c++.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/time_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/time_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include/bits/time_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_shared.so
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_shared.so
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_static.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libgnustl_static.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libsupc++.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libsupc++.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/atomic_word.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/basic_file.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/basic_file.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/basic_file.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++config.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++config.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++config.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++io.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++io.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++io.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++locale.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/c++locale.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/c++locale.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cpu_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cpu_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cpu_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_inline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_inline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_inline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_noninline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/ctype_noninline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/ctype_noninline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/cxxabi_tweaks.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/cxxabi_tweaks.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/error_constants.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/error_constants.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/error_constants.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/extc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/extc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/extc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-default.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-default.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-default.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-posix.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-posix.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-posix.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-single.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-single.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-single.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-tpf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr-tpf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr-tpf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/gthr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/gthr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/messages_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/messages_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/messages_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/os_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/os_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/os_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdtr1c++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/time_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/time_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/include/bits/time_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_shared.so
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_shared.so
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_static.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/libgnustl_static.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libsupc++.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/libsupc++.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/mips/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/atomic_word.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/basic_file.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/basic_file.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/basic_file.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++allocator.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++allocator.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++allocator.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++config.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++config.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++config.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++io.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++io.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++io.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++locale.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/c++locale.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/c++locale.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cpu_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cpu_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cpu_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_base.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_base.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_base.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_inline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_inline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_inline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_noninline.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/ctype_noninline.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/ctype_noninline.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cxxabi_tweaks.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/cxxabi_tweaks.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/cxxabi_tweaks.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/error_constants.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/error_constants.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/error_constants.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/extc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/extc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/extc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-default.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-default.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-default.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-posix.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-posix.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-posix.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-single.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-single.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-single.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-tpf.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr-tpf.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr-tpf.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/gthr.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/gthr.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/messages_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/messages_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/messages_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/os_defines.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/os_defines.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/os_defines.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdc++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdc++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdc++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdtr1c++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/time_members.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/time_members.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/include/bits/time_members.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_shared.so
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_shared.so
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_static.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/libgnustl_static.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libsupc++.a
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/libsupc++.a
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/x86/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/algorithm b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/algorithm
new file mode 100644
index 0000000..7449ec3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/array b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/array
new file mode 100644
index 0000000..a0bdd24
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/atomic b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/atomic
new file mode 100644
index 0000000..a19891d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/auto_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/auto_ptr.h
new file mode 100644
index 0000000..e868765
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/backward_warning.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/backward_warning.h
new file mode 100644
index 0000000..77dff05
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/binders.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/binders.h
new file mode 100644
index 0000000..f98b56a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_fun.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_fun.h
new file mode 100644
index 0000000..a76eb73
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_map
new file mode 100644
index 0000000..24c439e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hash_set
new file mode 100644
index 0000000..f110fec
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hashtable.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/hashtable.h
new file mode 100644
index 0000000..e04d8fa
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/strstream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/strstream
new file mode 100644
index 0000000..7e18a35
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/algorithmfwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/algorithmfwd.h
new file mode 100644
index 0000000..8632bf5
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/allocator.h
new file mode 100644
index 0000000..9d01a60
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_0.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_0.h
new file mode 100644
index 0000000..84ff779
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_2.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_2.h
new file mode 100644
index 0000000..f95beca
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/atomic_base.h
new file mode 100644
index 0000000..272a4cd
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.h
new file mode 100644
index 0000000..29d8ae5
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_ios.tcc
new file mode 100644
index 0000000..8ac6bfd
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.h
new file mode 100644
index 0000000..2f708b7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/basic_string.tcc
new file mode 100644
index 0000000..d988334
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/boost_concept_check.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/boost_concept_check.h
new file mode 100644
index 0000000..f1bc16a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/c++0x_warning.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/c++0x_warning.h
new file mode 100644
index 0000000..eb072d0
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/char_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/char_traits.h
new file mode 100644
index 0000000..07251df
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/codecvt.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/codecvt.h
new file mode 100644
index 0000000..6ae9bbe
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/concept_check.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/concept_check.h
new file mode 100644
index 0000000..9517e5c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cpp_type_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cpp_type_traits.h
new file mode 100644
index 0000000..166890f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cxxabi_forced.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/cxxabi_forced.h
new file mode 100644
index 0000000..c45ce79
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/deque.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/deque.tcc
new file mode 100644
index 0000000..6381022
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_defines.h
new file mode 100644
index 0000000..269937c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/exception_ptr.h
new file mode 100644
index 0000000..26117cd
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.h
new file mode 100644
index 0000000..39c2532
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/forward_list.tcc
new file mode 100644
index 0000000..2c319db
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/fstream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/fstream.tcc
new file mode 100644
index 0000000..3d5ca62
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functexcept.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functexcept.h
new file mode 100644
index 0000000..d8e6ae7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functional_hash.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/functional_hash.h
new file mode 100644
index 0000000..e892159
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice.h
new file mode 100644
index 0000000..47d1775
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/gslice_array.h
new file mode 100644
index 0000000..1ae047d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hash_bytes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hash_bytes.h
new file mode 100644
index 0000000..2f0c0ea
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable.h
new file mode 100644
index 0000000..8fdcfbf
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable_policy.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/hashtable_policy.h
new file mode 100644
index 0000000..f6e1876
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/indirect_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/indirect_array.h
new file mode 100644
index 0000000..d7b7b08
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ios_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ios_base.h
new file mode 100644
index 0000000..8825657
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/istream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/istream.tcc
new file mode 100644
index 0000000..9055c31
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/list.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/list.tcc
new file mode 100644
index 0000000..01c1bc6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.h
new file mode 100644
index 0000000..80ba735
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_classes.tcc
new file mode 100644
index 0000000..5b2901a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.h
new file mode 100644
index 0000000..41732f3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets.tcc
new file mode 100644
index 0000000..80bda15
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.h
new file mode 100644
index 0000000..be7c1a4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/locale_facets_nonio.tcc
new file mode 100644
index 0000000..fbf7005
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/localefwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/localefwd.h
new file mode 100644
index 0000000..38e7dd3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/mask_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/mask_array.h
new file mode 100644
index 0000000..8b652a8
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/move.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/move.h
new file mode 100644
index 0000000..f591899
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/nested_exception.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/nested_exception.h
new file mode 100644
index 0000000..d4804bb
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream.tcc
new file mode 100644
index 0000000..c0dce6a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream_insert.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/ostream_insert.h
new file mode 100644
index 0000000..f422865
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/postypes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/postypes.h
new file mode 100644
index 0000000..69235d9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.h
new file mode 100644
index 0000000..988ee61
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/random.tcc
new file mode 100644
index 0000000..b9f6af6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/range_access.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/range_access.h
new file mode 100644
index 0000000..0463791
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex.h
new file mode 100644
index 0000000..2bea0c3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_compiler.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_compiler.h
new file mode 100644
index 0000000..025c4fa
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_constants.h
new file mode 100644
index 0000000..bddef3a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_cursor.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_cursor.h
new file mode 100644
index 0000000..9feac1d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_error.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_error.h
new file mode 100644
index 0000000..c37a0fa
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.h
new file mode 100644
index 0000000..9312bb3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_grep_matcher.tcc
new file mode 100644
index 0000000..ae28f6f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.h
new file mode 100644
index 0000000..c4a65e6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/regex_nfa.tcc
new file mode 100644
index 0000000..9e4a6ce
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr.h
new file mode 100644
index 0000000..81ac382
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/shared_ptr_base.h
new file mode 100644
index 0000000..7badc39
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/slice_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/slice_array.h
new file mode 100644
index 0000000..3afae22
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/sstream.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/sstream.tcc
new file mode 100644
index 0000000..89b9a54
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algo.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algo.h
new file mode 100644
index 0000000..1d6026a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algobase.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_algobase.h
new file mode 100644
index 0000000..aecdcb9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_bvector.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_bvector.h
new file mode 100644
index 0000000..5bf10d9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_construct.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_construct.h
new file mode 100644
index 0000000..2efba93
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_deque.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_deque.h
new file mode 100644
index 0000000..0d9b5b4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_function.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_function.h
new file mode 100644
index 0000000..88655fc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_heap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_heap.h
new file mode 100644
index 0000000..b00fc69
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator.h
new file mode 100644
index 0000000..b23107d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_funcs.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_funcs.h
new file mode 100644
index 0000000..836aa92
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_types.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_iterator_base_types.h
new file mode 100644
index 0000000..9944dc4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_list.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_list.h
new file mode 100644
index 0000000..126de00
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_map.h
new file mode 100644
index 0000000..a1bef8b
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multimap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multimap.h
new file mode 100644
index 0000000..02e8f58
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multiset.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_multiset.h
new file mode 100644
index 0000000..9a48916
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_numeric.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_numeric.h
new file mode 100644
index 0000000..6cbc6d2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_pair.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_pair.h
new file mode 100644
index 0000000..8d137b2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_queue.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_queue.h
new file mode 100644
index 0000000..5f20072
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_raw_storage_iter.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_raw_storage_iter.h
new file mode 100644
index 0000000..87c9a66
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_relops.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_relops.h
new file mode 100644
index 0000000..4e79e54
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_set.h
new file mode 100644
index 0000000..77d0f80
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_stack.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_stack.h
new file mode 100644
index 0000000..73c8bbd
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tempbuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tempbuf.h
new file mode 100644
index 0000000..a99dac9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h
new file mode 100644
index 0000000..a7e9564
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_uninitialized.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_uninitialized.h
new file mode 100644
index 0000000..70ce545
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_vector.h
new file mode 100644
index 0000000..8b7fdb1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stream_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stream_iterator.h
new file mode 100644
index 0000000..57ca961
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf.tcc
new file mode 100644
index 0000000..6cb85fc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/streambuf_iterator.h
new file mode 100644
index 0000000..83ae678
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stringfwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stringfwd.h
new file mode 100644
index 0000000..5f2d49c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unique_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unique_ptr.h
new file mode 100644
index 0000000..cb2d860
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_map.h
new file mode 100644
index 0000000..c77bab1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/unordered_set.h
new file mode 100644
index 0000000..38350bc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_after.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_after.h
new file mode 100644
index 0000000..6440fae
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.h
new file mode 100644
index 0000000..cba9f3f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_array.tcc
new file mode 100644
index 0000000..7720707
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_before.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/valarray_before.h
new file mode 100644
index 0000000..0755f76
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/vector.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/vector.tcc
new file mode 100644
index 0000000..cd23f76
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bitset b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/bitset
new file mode 100644
index 0000000..ee771be
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cassert b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cassert
new file mode 100644
index 0000000..dc8af68
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ccomplex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ccomplex
new file mode 100644
index 0000000..b1117e8
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cctype
new file mode 100644
index 0000000..0fed691
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cerrno b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cerrno
new file mode 100644
index 0000000..0451cd9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfenv b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfenv
new file mode 100644
index 0000000..35010a0
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfloat b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cfloat
new file mode 100644
index 0000000..1be81d3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/chrono b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/chrono
new file mode 100644
index 0000000..89ded2c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cinttypes b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cinttypes
new file mode 100644
index 0000000..df73340
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ciso646 b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ciso646
new file mode 100644
index 0000000..55594ae
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/climits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/climits
new file mode 100644
index 0000000..f080fcb
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/clocale b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/clocale
new file mode 100644
index 0000000..3f16bff
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cmath
new file mode 100644
index 0000000..6e8cd13
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex
new file mode 100644
index 0000000..da3c469
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/complex.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/complex.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/complex.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/condition_variable b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/condition_variable
new file mode 100644
index 0000000..ff65dc4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/csetjmp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/csetjmp
new file mode 100644
index 0000000..2832801
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/csignal b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/csignal
new file mode 100644
index 0000000..98f0d66
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdarg b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdarg
new file mode 100644
index 0000000..fb27389
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdbool b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdbool
new file mode 100644
index 0000000..dd428f2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstddef b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstddef
new file mode 100644
index 0000000..d9a7383
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdint b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdint
new file mode 100644
index 0000000..ce8143e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdio
new file mode 100644
index 0000000..049704d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdlib b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstdlib
new file mode 100644
index 0000000..aa7530d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstring b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cstring
new file mode 100644
index 0000000..ea33fa1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctgmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctgmath
new file mode 100644
index 0000000..6b51005
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctime b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ctime
new file mode 100644
index 0000000..085e792
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwchar b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwchar
new file mode 100644
index 0000000..a2b1168
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cwctype
new file mode 100644
index 0000000..e417b68
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cxxabi.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/cxxabi.h
new file mode 100644
index 0000000..c93085a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/bitset b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/bitset
new file mode 100644
index 0000000..09929e7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/debug.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/debug.h
new file mode 100644
index 0000000..6ea8e2a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/deque b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/deque
new file mode 100644
index 0000000..fc4d8cb
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/formatter.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/formatter.h
new file mode 100644
index 0000000..065a502
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/forward_list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/forward_list
new file mode 100644
index 0000000..70bd75a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/functions.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/functions.h
new file mode 100644
index 0000000..75ed9ef
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/list
new file mode 100644
index 0000000..a7a2c54
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/macros.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/macros.h
new file mode 100644
index 0000000..c90bec5
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/map
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/map.h
new file mode 100644
index 0000000..177797d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multimap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multimap.h
new file mode 100644
index 0000000..d2e1976
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multiset.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/multiset.h
new file mode 100644
index 0000000..6808fb8
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_base.h
new file mode 100644
index 0000000..1348004
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.h
new file mode 100644
index 0000000..127c3ba
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_iterator.tcc
new file mode 100644
index 0000000..942640c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.h
new file mode 100644
index 0000000..cc1f4c1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/safe_sequence.tcc
new file mode 100644
index 0000000..bf0295c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/debug/set
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/set.h
new file mode 100644
index 0000000..7ca4c77
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/string b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/string
new file mode 100644
index 0000000..fe073f2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_map
new file mode 100644
index 0000000..43b1e9c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/unordered_set
new file mode 100644
index 0000000..cf21a3c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/vector b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/debug/vector
new file mode 100644
index 0000000..edb1f88
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal
new file mode 100644
index 0000000..d65b814
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/decimal/decimal.h
new file mode 100644
index 0000000..f8f0573
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/deque b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/deque
new file mode 100644
index 0000000..7b0604b
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/exception b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/exception
new file mode 100644
index 0000000..db75ad1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/algorithm b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/algorithm
new file mode 100644
index 0000000..417a03a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/array_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/array_allocator.h
new file mode 100644
index 0000000..9c61d74
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/atomicity.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/atomicity.h
new file mode 100644
index 0000000..f0c7752
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/bitmap_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/bitmap_allocator.h
new file mode 100644
index 0000000..4993c2c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/cast.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/cast.h
new file mode 100644
index 0000000..f3384f9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/codecvt_specializations.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/codecvt_specializations.h
new file mode 100644
index 0000000..38b95ef
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/concurrence.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/concurrence.h
new file mode 100644
index 0000000..fc8f63f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/debug_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/debug_allocator.h
new file mode 100644
index 0000000..12a5ea6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/enc_filebuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/enc_filebuf.h
new file mode 100644
index 0000000..058d330
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/extptr_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/extptr_allocator.h
new file mode 100644
index 0000000..dfb76ac
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/functional
new file mode 100644
index 0000000..7e8acdf
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_map
new file mode 100644
index 0000000..24c439e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/hash_set
new file mode 100644
index 0000000..f110fec
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/iterator b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/iterator
new file mode 100644
index 0000000..3e8f438
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/malloc_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/malloc_allocator.h
new file mode 100644
index 0000000..3aa994d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/memory b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/memory
new file mode 100644
index 0000000..ddcfe22
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/mt_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/mt_allocator.h
new file mode 100644
index 0000000..91eac24
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/new_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/new_allocator.h
new file mode 100644
index 0000000..35d5cdc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric
new file mode 100644
index 0000000..b389177
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/numeric_traits.h
new file mode 100644
index 0000000..e84e298
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/assoc_container.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/assoc_container.hpp
new file mode 100644
index 0000000..9cec3b7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_types.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/basic_types.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/basic_types.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cond_dealtor.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/cond_dealtor.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/cond_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/container_base_dispatch.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/container_base_dispatch.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/container_base_dispatch.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/debug_map_base.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/head.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/head.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/head.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/pat_trie_/traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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 android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp b/android-ndk-r8/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%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp b/android-ndk-r8/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%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
rename to android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/node.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/node.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/node.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/traits.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/splay_tree_/traits.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/splay_tree_/traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/standard_policies.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/standard_policies.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/standard_policies.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_trace_base.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/tree_trace_base.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/tree_trace_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/type_utils.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/types_traits.hpp
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/ext/pb_ds/detail/types_traits.hpp
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/types_traits.hpp
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/exception.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/exception.hpp
new file mode 100644
index 0000000..b34e3ed
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/hash_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/hash_policy.hpp
new file mode 100644
index 0000000..f3bc86e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/list_update_policy.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/priority_queue.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/priority_queue.hpp
new file mode 100644
index 0000000..b6088e7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tag_and_trait.hpp b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tree_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/tree_policy.hpp
new file mode 100644
index 0000000..4af1adb
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/trie_policy.hpp b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pb_ds/trie_policy.hpp
new file mode 100644
index 0000000..fc45210
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pod_char_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pod_char_traits.h
new file mode 100644
index 0000000..3c9f098
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pointer.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pointer.h
new file mode 100644
index 0000000..158ae52
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pool_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/pool_allocator.h
new file mode 100644
index 0000000..66ddced
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rb_tree b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rb_tree
new file mode 100644
index 0000000..4293a75
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rc_string_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rc_string_base.h
new file mode 100644
index 0000000..4a27ff6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rope b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/rope
new file mode 100644
index 0000000..4292151
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/ropeimpl.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/ropeimpl.h
new file mode 100644
index 0000000..467b8fd
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/slist b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/slist
new file mode 100644
index 0000000..e678190
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/sso_string_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/sso_string_base.h
new file mode 100644
index 0000000..39a62d6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_filebuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_filebuf.h
new file mode 100644
index 0000000..5ab2ff7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_sync_filebuf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/stdio_sync_filebuf.h
new file mode 100644
index 0000000..4b60149
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/string_conversions.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/string_conversions.h
new file mode 100644
index 0000000..f85ab99
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/throw_allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/throw_allocator.h
new file mode 100644
index 0000000..778b8de
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/type_traits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/type_traits.h
new file mode 100644
index 0000000..51db03e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/typelist.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/typelist.h
new file mode 100644
index 0000000..7f94ecd
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.h
new file mode 100644
index 0000000..19df375
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring.tcc
new file mode 100644
index 0000000..588985b
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_fwd.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_fwd.h
new file mode 100644
index 0000000..ce8cf53
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_util.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/vstring_util.h
new file mode 100644
index 0000000..fdf3981
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/fenv.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/fenv.h
new file mode 100644
index 0000000..2096e39
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/forward_list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/forward_list
new file mode 100644
index 0000000..a1befcf
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/fstream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/fstream
new file mode 100644
index 0000000..8ad6e5c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/functional
new file mode 100644
index 0000000..45bee81
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/future b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/future
new file mode 100644
index 0000000..970ce76
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/initializer_list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/initializer_list
new file mode 100644
index 0000000..1048d44
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iomanip b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iomanip
new file mode 100644
index 0000000..91f90e5
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ios b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ios
new file mode 100644
index 0000000..9cf8368
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iosfwd b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iosfwd
new file mode 100644
index 0000000..8906a1d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iostream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iostream
new file mode 100644
index 0000000..7c71ba4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/istream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/istream
new file mode 100644
index 0000000..fb39392
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iterator b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/iterator
new file mode 100644
index 0000000..90152b7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/limits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/limits
new file mode 100644
index 0000000..9a31197
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/list
new file mode 100644
index 0000000..abcba85
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/locale b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/locale
new file mode 100644
index 0000000..cfb152a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/map
new file mode 100644
index 0000000..b2e3bf5
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/memory b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/memory
new file mode 100644
index 0000000..791ffe0
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/mutex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/mutex
new file mode 100644
index 0000000..36f894e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/new b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/new
new file mode 100644
index 0000000..7f7fdb8
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/numeric b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/numeric
new file mode 100644
index 0000000..1acedf4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ostream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ostream
new file mode 100644
index 0000000..3004d4b
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/base.h
new file mode 100644
index 0000000..ef17443
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/bitset b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/bitset
new file mode 100644
index 0000000..381f1ea
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/deque b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/deque
new file mode 100644
index 0000000..1c0e53c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/forward_list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/forward_list
new file mode 100644
index 0000000..00af855
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler.h
new file mode 100644
index 0000000..ab9cd90
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_algos.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_algos.h
new file mode 100644
index 0000000..d4de43e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_container_size.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_container_size.h
new file mode 100644
index 0000000..12cee54
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hash_func.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hash_func.h
new file mode 100644
index 0000000..9f6c641
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hashtable_size.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_hashtable_size.h
new file mode 100644
index 0000000..9d5cbc7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_slist.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_list_to_vector.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_map_to_unordered_map.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_node.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_node.h
new file mode 100644
index 0000000..c32b94e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_state.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_state.h
new file mode 100644
index 0000000..111b97e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_trace.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_trace.h
new file mode 100644
index 0000000..1e00542
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_size.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_size.h
new file mode 100644
index 0000000..0af384f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/impl/profiler_vector_to_list.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/iterator_tracker.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/iterator_tracker.h
new file mode 100644
index 0000000..733429d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/list b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/list
new file mode 100644
index 0000000..21279d2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map
new file mode 100644
index 0000000..e396b85
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/map.h
new file mode 100644
index 0000000..a58a2b0
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multimap.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multimap.h
new file mode 100644
index 0000000..3ee169b
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multiset.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/multiset.h
new file mode 100644
index 0000000..c6902a0
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set
new file mode 100644
index 0000000..11603a8
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/set.h
new file mode 100644
index 0000000..d10a11f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_map
new file mode 100644
index 0000000..cc54009
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/unordered_set
new file mode 100644
index 0000000..547fb76
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/vector b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/profile/vector
new file mode 100644
index 0000000..3e81c0f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/queue b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/queue
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/queue
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/queue
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/random b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/random
new file mode 100644
index 0000000..59aed8e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ratio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/ratio
new file mode 100644
index 0000000..17d28a1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/regex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/regex
new file mode 100644
index 0000000..eabb843
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/set
new file mode 100644
index 0000000..52fcbaa
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/sstream b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/sstream
new file mode 100644
index 0000000..bf2862a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stack b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/stack
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/stack
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/stack
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/stdexcept b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/stdexcept
new file mode 100644
index 0000000..a461795
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/streambuf b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/streambuf
new file mode 100644
index 0000000..b46efec
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/string b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/string
new file mode 100644
index 0000000..2893396
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/system_error b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/system_error
new file mode 100644
index 0000000..6ef070a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tgmath.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tgmath.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tgmath.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/thread b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/thread
new file mode 100644
index 0000000..bd102fc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/array b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/array
new file mode 100644
index 0000000..058fcfa
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/bessel_function.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/bessel_function.tcc
new file mode 100644
index 0000000..b525ebc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/beta_function.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/beta_function.tcc
new file mode 100644
index 0000000..219f3cb
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ccomplex
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ccomplex
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ccomplex
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cctype
new file mode 100644
index 0000000..0cec3d9
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfenv b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfenv
new file mode 100644
index 0000000..980a06c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfloat
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cfloat
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cfloat
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cinttypes b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cinttypes
new file mode 100644
index 0000000..f1ca292
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/climits
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/climits
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/climits
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cmath
new file mode 100644
index 0000000..9ada637
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex
new file mode 100644
index 0000000..689ea16
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/complex.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/complex.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdarg
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdarg
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdarg
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdbool
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/cstdbool
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdbool
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdint b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdint
new file mode 100644
index 0000000..55ce4bc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdio b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdio
new file mode 100644
index 0000000..415e8a4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdlib b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cstdlib
new file mode 100644
index 0000000..6e3e16d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctgmath
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctgmath
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctgmath
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctime
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctime
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctime
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctype.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/ctype.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ctype.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwchar b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwchar
new file mode 100644
index 0000000..8bf775b
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwctype b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/cwctype
new file mode 100644
index 0000000..452a7b4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ell_integral.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/ell_integral.tcc
new file mode 100644
index 0000000..4dfe616
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/exp_integral.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/exp_integral.tcc
new file mode 100644
index 0000000..cf3bd63
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/fenv.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/fenv.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/fenv.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/float.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/float.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/float.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional
new file mode 100644
index 0000000..31e72d6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional_hash.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/functional_hash.h
new file mode 100644
index 0000000..1742e15
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/gamma.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/gamma.tcc
new file mode 100644
index 0000000..a7c399c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable.h
new file mode 100644
index 0000000..5d1e02c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable_policy.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hashtable_policy.h
new file mode 100644
index 0000000..82f8fde
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hypergeometric.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/hypergeometric.tcc
new file mode 100644
index 0000000..b98b5b2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/inttypes.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/inttypes.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/inttypes.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/legendre_function.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/legendre_function.tcc
new file mode 100644
index 0000000..db41d4e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/limits.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/limits.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/limits.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/math.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/math.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/math.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/memory b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/memory
new file mode 100644
index 0000000..eaf4932
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/modified_bessel_func.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/modified_bessel_func.tcc
new file mode 100644
index 0000000..ec134d5
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_hermite.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_hermite.tcc
new file mode 100644
index 0000000..95e8079
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_laguerre.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/poly_laguerre.tcc
new file mode 100644
index 0000000..769923d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random
new file mode 100644
index 0000000..5592647
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.h
new file mode 100644
index 0000000..ace3792
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/random.tcc
new file mode 100644
index 0000000..3d8c4fe
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/regex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/regex
new file mode 100644
index 0000000..714a06d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/riemann_zeta.tcc b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/riemann_zeta.tcc
new file mode 100644
index 0000000..18fe20e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/shared_ptr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/shared_ptr.h
new file mode 100644
index 0000000..c42084c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/special_function_util.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/special_function_util.h
new file mode 100644
index 0000000..c90fc59
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdarg.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdarg.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdarg.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdbool.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdbool.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdbool.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdint.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdint.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdint.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdio.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdio.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdio.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdlib.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/stdlib.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/stdlib.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tgmath.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/tgmath.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tgmath.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tuple b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/tuple
new file mode 100644
index 0000000..15ac642
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/type_traits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/type_traits
new file mode 100644
index 0000000..2825fe6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map
new file mode 100644
index 0000000..50bab9e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_map.h
new file mode 100644
index 0000000..96404d3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set
new file mode 100644
index 0000000..3e2cbb0
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/unordered_set.h
new file mode 100644
index 0000000..e65a4cc
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/utility b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/utility
new file mode 100644
index 0000000..ef3673a
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wchar.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wchar.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wchar.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wctype.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include/tr1/wctype.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tr1/wctype.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tuple b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/tuple
new file mode 100644
index 0000000..fb452ae
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/type_traits b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/type_traits
new file mode 100644
index 0000000..2361152
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeindex b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeindex
new file mode 100644
index 0000000..78aeeb1
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeinfo b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/typeinfo
new file mode 100644
index 0000000..22ef49f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_map b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_map
new file mode 100644
index 0000000..e77a297
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_set b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/unordered_set
new file mode 100644
index 0000000..739e0a4
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/utility b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/utility
new file mode 100644
index 0000000..245c41f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/valarray b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/valarray
new file mode 100644
index 0000000..9c18e05
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/vector b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/include/vector
new file mode 100644
index 0000000..5ea82d8
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/atomic_word.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/atomic_word.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/basic_file.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++allocator.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++config.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++io.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/c++locale.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cpu_defines.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_base.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_inline.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/ctype_noninline.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/cxxabi_tweaks.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/error_constants.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-default.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-posix.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-single.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr-tpf.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/messages_members.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/os_defines.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdtr1c++.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/bits/stdtr1c++.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits/time_members.h b/android-ndk-r8/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/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_shared.so
new file mode 100755
index 0000000..7550d91
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
new file mode 100644
index 0000000..c818709
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a
new file mode 100644
index 0000000..6f590ec
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/atomic_word.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/atomic_word.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++config.h
new file mode 100644
index 0000000..2f0c5c6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..2ac349d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-default.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdtr1c++.h
similarity index 100%
rename from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/bits/stdtr1c++.h
rename to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_shared.so
new file mode 100755
index 0000000..2b3ff47
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a
new file mode 100644
index 0000000..44849c8
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a
new file mode 100644
index 0000000..43eed27
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/atomic_word.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/atomic_word.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++config.h
new file mode 100644
index 0000000..f087e98
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..f48f73e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-default.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdtr1c++.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/mips/include/bits/stdtr1c++.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_shared.so
new file mode 100755
index 0000000..69247e4
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_static.a
new file mode 100644
index 0000000..5fc3cf8
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libsupc++.a
new file mode 100644
index 0000000..4531f3f
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/mips/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/atomic_word.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/atomic_word.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/atomic_word.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/basic_file.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/basic_file.h
new file mode 100644
index 0000000..f543a89
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++allocator.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++allocator.h
new file mode 100644
index 0000000..6f8aef3
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++config.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++config.h
new file mode 100644
index 0000000..2a2d1c2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++io.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++io.h
new file mode 100644
index 0000000..0843df7
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++locale.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/c++locale.h
new file mode 100644
index 0000000..fa42918
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cpu_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cpu_defines.h
new file mode 100644
index 0000000..c1b9863
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_base.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_base.h
new file mode 100644
index 0000000..926b233
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_inline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_inline.h
new file mode 100644
index 0000000..e7b8d5c
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_noninline.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/ctype_noninline.h
new file mode 100644
index 0000000..78bc296
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cxxabi_tweaks.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/cxxabi_tweaks.h
new file mode 100644
index 0000000..f48f73e
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/error_constants.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/error_constants.h
new file mode 100644
index 0000000..88ea565
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/extc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/extc++.h
new file mode 100644
index 0000000..03e5339
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-default.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-default.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-posix.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-posix.h
new file mode 100644
index 0000000..2ecfce2
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-single.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-single.h
new file mode 100644
index 0000000..692688f
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-tpf.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr-tpf.h
new file mode 100644
index 0000000..df194e6
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/gthr.h
new file mode 100644
index 0000000..a466c11
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/messages_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/messages_members.h
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/os_defines.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/os_defines.h
new file mode 100644
index 0000000..0c8f77d
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdc++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdc++.h
new file mode 100644
index 0000000..510a655
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdtr1c++.h
similarity index 100%
copy from android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs/x86/include/bits/stdtr1c++.h
copy to android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/stdtr1c++.h
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/time_members.h b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/include/bits/time_members.h
new file mode 100644
index 0000000..ff26bef
--- /dev/null
+++ b/android-ndk-r8/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/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_shared.so b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_shared.so
new file mode 100755
index 0000000..8b7f0ef
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_shared.so
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_static.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_static.a
new file mode 100644
index 0000000..ebe9532
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libgnustl_static.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libsupc++.a b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libsupc++.a
new file mode 100644
index 0000000..6e100f7
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86/libsupc++.a
Binary files differ
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include
new file mode 120000
index 0000000..0e7f94e
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/include
@@ -0,0 +1 @@
+4.6/include
\ No newline at end of file
diff --git a/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs
new file mode 120000
index 0000000..050a8bb
--- /dev/null
+++ b/android-ndk-r8/sources/cxx-stl/gnu-libstdc++/libs
@@ -0,0 +1 @@
+4.6/libs
\ No newline at end of file
